Copy Code code as follows:
<%
REM article title: Using the VBS class to implement CSS buttons
REM Author: Yanek
REM Contact: 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 ' 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 establishes an instance of a class
Dim Btnyahoo, Btnlycos
Set Btnyahoo = New Cssbutton
Set Btnlycos = New Cssbutton
REM Set the related properties of the button object
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 Call Method Output button
Response.Write Btnyahoo.generatestyletag ()
Response.Write Btnyahoo.generatebuttontag ()
Response.Write "<p> </p>"
REM Set the related properties of the button object
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 Call Method Output button
Response.Write Btnlycos.generatestyletag ()
Response.Write Btnlycos.generatebuttontag ()
%>
Demo: http://www.cnaspol.com/vbsclasscssbutton.asp