4 回答
TA贡献1799条经验 获得超9个赞
例子1:调用函数方式
<HTML>
<HEAD>
<TITLE>测试按钮事件</TITLE>
<SCRIPT LANGUAGE="VBScript">
Function test()
msgbox "你还真点我?"
End Function
</SCRIPT>
</HEAD>
<BODY>
<input type="button" value="点击我" onclick="vbscript:test()">
</BODY>
</HTML>
=====================================================
例子2:事件触发方式
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>VBSCRIPT与html</title>
</head>
<script language="vbscript">
option explicit
dim a,b,c
sub btmshow_onclick
a=abc.text1.value
b=abc.text2.value
if a>b then
c = a
else
c=b
end if
abc.text3.value=c
end sub
</script>
<body>
<form name="abc">
<p>请输入第一个数字:<input type="text" width="60" name="text1"></p>
<p>请输入第二个数字:<input type="text" width="60" name="text2"></p>
<p>两个数字最大值为:<input type="text" width="60" name="text3"></p>
<p><input type="button" name="btmshow" value="输入"></button>
<input type="reset" name="reshow" value="重设"></p>
</form>
</body>
</html>
====================================================
例子3:在窗体中嵌入脚本代码以响应窗体中按钮的单击事件
<HTML>
<HEAD>
<TITLE>测试按钮事件</TITLE>
</HEAD>
<BODY>
<FORM NAME="Form1">
<INPUT TYPE="Button" NAME="Button1" VALUE="单击">
<SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript">
MsgBox "按钮被单击!"
</SCRIPT>
</FORM>
</BODY>
</HTML>
TA贡献1817条经验 获得超14个赞
<head>
<title>23</title>
<script type="text/vbscript">
Function printa()
document.getElementById("aa1").innerText=document.getElementById("aa").value
document.getElementById("bb1").innerText=document.getElementById("bb").value
end Function
</script>
</head>
<body>
<input type="text" id="aa" value="111" name="aa"/>
<input type="text" id="bb" value="21" name="bb"/>
<button onClick="printa">点击我</button>
<div id=aa1></div>
<div id=bb1></div>
</body>
</html>
TA贡献1831条经验 获得超9个赞
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <head> <title>23</title> <script type="text/vbscript"> Function printa() document.getElementById("aa1").innerText=document.getElementById("aa").value document.getElementById("bb1").innerText=document.getElementById("bb").value end Function </script> </head> <body> <input type="text" id="aa" value="111" name="aa"/> <input type="text" id="bb" value="21" name="bb"/> <button onClick="printa">点击我</button> <div id=aa1></div> <div id=bb1></div> </body> </html> |
- 4 回答
- 0 关注
- 496 浏览
添加回答
举报