Code for implementing the css button using the vbs class

Source: Internet
Author: User

Copy codeThe Code is as follows: <%
Rem article title: css buttons using the vbs class
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 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 &_
"A. buttontext" & Name & "{color:" & FontColor & ";" & vbCrLf &_
"Text-decoration: none;" & vbCrLf &_
"Font:" & Font & ";" & vbCrLf &_
"Cursor: hand;}" & 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 creates a class instance

Dim btnYahoo, btnLycos
Set btnYahoo = New CssButton
Set btnLycos = New CssButton

Rem sets the properties of the button object

BtnYahoo. BackColor = "# aaaaaa"
BtnYahoo. BorderColor = "# bbbbbbbb"
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 sets the properties of the button object
BtnLycos. BackColor = "# aaaaaa"
BtnLycos. BorderColor = "# bbbbbbbb"
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.