国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > VBScript > 正文

利用vbs類實現css按鈕的代碼

2020-06-26 18:05:14
字體:
來源:轉載
供稿:網友
代碼如下:

<%  
rem 文章標題: 利用vbs類實現css按鈕  
rem 作者:yanek  
rem 聯系:aspboy@263.net  

Class CssButton  

  Public Name  
  Public BackColor  
  Public BorderColor  
  Public Font  
  Public FontColor  
  Public Width  
  Public Text  
  Public Url  

  Public MouseOverColor  

      
  Public Function GenerateStyleTag()  
    'Create the STYLE tag  
    Dim strStyle  
    strStyle =     "<STYLE TYPE=""text/css"">" & vbCrLf & _  
                   "<!--" & vbCrLf & _  
                   "#mybutton" & Name & "   {border-style: inset; " & vbCrLf & _  
                   "             border-color: " & BorderColor & ";" & vbCrLf & _  
                   "             background-color: " & BackColor & ";" & vbCrLf & _  
                   "             width: " & Width & ";" & vbCrLf & _  
                   "             text-align: center; }" & vbCrLf & vbCrLf & vbCrLf & _  
                   "A.buttontext" & Name & " {color: " & FontColor & "; " & vbCrLf & _  
                   "              text-decoration: none; " & vbCrLf & _  
                   "              font: " & Font & ";" & vbCrLf & _  
                   "              cursor: hand; }" & vbCrLf & vbCrLf & vbCrLf & _  
                   ".buttonover" & Name & " {color: " & MouseOverColor & ";" & vbCrLf & _  
                   "             text-decoration: none; " & vbCrLf & _  
                   "             font: " & Font & ";" & vbCrLf & _  
                   "             cursor: hand; }" & vbCrLf & _  
                   " // -->" & vbCrLf & _  
                   "</STYLE>"  

    GenerateStyleTag = strStyle  
  End Function  


  Public Function GenerateButtonTag()  
    Dim strHTML  
    strHTML = "<a href=""" & Url & """ class=""buttontext" & Name & """ " & _  
              "onMouseOver=""this.className='buttonover" & Name & "';"" " & _  
              "onMouseOut=""this.className='buttontext" & Name & "';"">" & _  
              vbCrLf & "<div id=""mybutton" & Name & """>" & vbCrLf & Text & vbCrLf & "</div></a>" & vbCrLf  

    GenerateButtonTag = strHTML  
  End Function  

End Class  

rem 建立類的實例  

Dim btnYahoo, btnLycos  
Set btnYahoo = New CssButton  
Set btnLycos = New CssButton  

rem 設置按鈕對象的相關屬性  

btnYahoo.BackColor = "#aaaaaa"  
btnYahoo.BorderColor = "#bbbbbb"  
btnYahoo.Font = "bold 12pt Verdana"  
btnYahoo.FontColor = "black"  
btnYahoo.Width = "80px"  
btnYahoo.MouseOverColor = "yellow"  
btnYahoo.Url = "http://www.yahoo.com/"  
btnYahoo.Name = "yahoo"  
btnYahoo.Text = "Yahoo!"  

rem 調用方法輸出按鈕  
Response.Write btnYahoo.GenerateStyleTag()  
Response.Write btnYahoo.GenerateButtonTag()  
Response.Write "<p> </p>"  



rem 設置按鈕對象的相關屬性  
btnLycos.BackColor = "#aaaaaa"  
btnLycos.BorderColor = "#bbbbbb"  
btnLycos.Font = "10pt Arial"  
btnLycos.FontColor = "black"  
btnLycos.Width = "70px"  
btnLycos.MouseOverColor = "yellow"  
btnLycos.Url = "http://www.lycos.com/"  
btnLycos.Name = "lycos"  
btnLycos.Text = "Lycos"  

rem 調用方法輸出按鈕  
Response.Write btnLycos.GenerateStyleTag()  
Response.Write btnLycos.GenerateButtonTag()  
%> 



演示:http://www.cnaspol.com/vbsclasscssbutton.asp 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 阳原县| 兰西县| 河曲县| 阿拉尔市| 海丰县| 洪江市| 龙井市| 朝阳市| 宜宾市| 嘉义市| 博客| 墨竹工卡县| 峨山| 馆陶县| 宁晋县| 南昌市| 丰都县| 巫溪县| 伊金霍洛旗| 东台市| 木里| 兴山县| 科尔| 大英县| 榆树市| 江阴市| 龙海市| 扎囊县| 西乌珠穆沁旗| 武清区| 盱眙县| 融水| 定襄县| 修文县| 永登县| 垫江县| 舟曲县| 社旗县| 横山县| 固阳县| 日照市|