利用vbs类实现css按钮的代码

2016-02-19 19:48 32 1 收藏

下面是个简单易学的利用vbs类实现css按钮的代码教程,图老师小编详细图解介绍包你轻松学会,喜欢的朋友赶紧get起来吧!

【 tulaoshi.com - Web开发 】

%
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.tulaoshi.com/webkaifa/)

来源:http://www.tulaoshi.com/n/20160219/1621826.html

延伸阅读
标签: Web开发
有两文件: objXML.asp:测试文件 clsXML.asp:vbs类文件 代码: objXML.asp %@ Language=VBScript % % Option Explicit % !--#INCLUDE FILE="clsXML.asp"-- % Dim objXML, strPath, str Set objXML = New clsXML strPath = Server.MapPath(".") & "New.xml" objXML.createFile strPath, "Root" 'Or If using an existing XML file: &#...
标签: Web开发
用CSS实现文字垂直居中的代码 style type="text/css" !-- .con_div{ width:400px; height:300px; border:1px solid #777; text-align:center; display:table-cell; vertical-align:middle; background:red; color:#fff } /*FOR IE*/ .webjx{ width:0; height:100%; display:inline-block; vertical-align:middle; } -- /style div class="...
标签: Web开发
点击添加 动态添加两个文本框: 分别表示x和y的值,点击取消 删除本行的2个文本框 记得要引入jquery.js 代码如下: script type="text/javascript" src="js/jquery.js"/script script type="text/javascript" $(function() { $("#btnMian").click(function() { //生成 0 到100000 随机数 Mapth.random产生 0到1的随机数 然后乘以10000...
标签: Web开发
代码如下: /** * ppagination.js * p通用的基于AJAX的分页类 * @author jeanwendy * @version 1.0 */ var paginationIndex = 0; var pagination = function(trTemplatId) {     $().ajaxStart(function() {         $.blockUI({       ...
标签: ASP
本文章有两文件组成 test.asp 测试演示文件 clsrsa.asp 实现rsa加密与解密的vbs类文件 下面是代码: 1. test.asp <% rem 文章标题:在asp中通过vbs类实现rsa加密与解密 rem 收集整理:yanek rem 联系:aspboy@263.net % <%Option Explicit% <!--#INCLUDE FILE="clsRSA.asp"-- <% Dim LngKeyE Dim LngKeyD Dim LngKeyN Dim StrMe...

经验教程

827

收藏

92
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部