Using the VBS class to implement the code _vbs of CSS Buttons

Source: Internet
Author: User
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>&lt ;/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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.