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

首頁 > 編程 > VBScript > 正文

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

2020-07-26 12:05:04
字體:
來源:轉載
供稿:網友
復制代碼 代碼如下:

<% 
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
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 广河县| 绵阳市| 辽阳市| 建平县| 达拉特旗| 屏东县| 杭锦旗| 泰顺县| 新化县| 广南县| 玉田县| 邢台县| 永登县| 岳普湖县| 汉川市| 尖扎县| 南雄市| 甘德县| 富顺县| 皮山县| 阜阳市| 府谷县| 开原市| 文水县| 万载县| 乌海市| 那坡县| 剑阁县| 思茅市| 钦州市| 海淀区| 静宁县| 霞浦县| 绥棱县| 永福县| 青海省| 博客| 高碑店市| 辉南县| 收藏| 邢台县|