国产探花免费观看_亚洲丰满少妇自慰呻吟_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 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 章丘市| 南江县| 兴安县| 西平县| 五峰| 鞍山市| 闸北区| 曲阜市| 泊头市| 东台市| 邵阳县| 雷山县| 古蔺县| 巫山县| 梁山县| 纳雍县| 鄂州市| 武义县| 邯郸市| 临邑县| 北票市| 雷波县| 枣庄市| 新和县| 额尔古纳市| 布拖县| 长春市| 宁晋县| 平陆县| 瓦房店市| 岳阳市| 许昌市| 舞钢市| 南江县| 绥中县| 博爱县| 大埔县| 嘉义市| 伊春市| 澎湖县| 沾化县|