4 回答

TA貢獻1797條經驗 獲得超6個贊
例子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貢獻1831條經驗 獲得超10個贊
<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貢獻1777條經驗 獲得超10個贊
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 關注
- 1024 瀏覽
添加回答
舉報