雷火电竞-中国电竞赛事及体育赛事平台

歡迎來到入門教程網!

vb

當前位置:主頁 > 軟件編程 > vb >

利用vbs類實現(xiàn)css按鈕的代碼

來源:本站原創(chuàng)|時間:2020-01-10|欄目:vb|點擊:

復制代碼 代碼如下:

<% 
rem 文章標題: 利用vbs類實現(xiàn)css按鈕 
rem 作者:yanek 
rem 聯(lián)系: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

上一篇:vbs定時發(fā)送郵件的方法與代碼

欄    目:vb

下一篇:靈活實用的VBS入門教程基礎篇

本文標題:利用vbs類實現(xiàn)css按鈕的代碼

本文地址:http://www.jygsgssxh.com/a1/vb/7975.html

網頁制作CMS教程網絡編程軟件編程腳本語言數(shù)據庫服務器

如果侵犯了您的權利,請與我們聯(lián)系,我們將在24小時內進行處理、任何非本站因素導致的法律后果,本站均不負任何責任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網 版權所有