下面是引用philips980於2007-06-16 15:16發表的 vb加法顯示問題:
a = Val(Text1)
b = Val(Text2)
c = Val(Text3)
Print (a + b + c)
.......
我給你一個vbscript 的範例
<!--請尊重智慧財產權,勿隨便複製!-->
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>新增網頁1</title>
<script language="vbscript">
sub f()
a = cint(document.xxx.a.value)
b = cint(document.xxx.b.value)
c = cint(document.xxx.c.value)
sum = a + b + c
document.xxx.sum.value = sum
end sub
</script>
</head>
<body>
<form name="xxx">
A = <input type="text" name="a" size=3><br>
B = <input type="text" name="b" size=3><br>
C = <input type="text" name="c" size=3><br>
<input type="button" value=" = " onclick="f()"><br>
A + B + C = <input type="text" name="sum" size=5><br>
</form>
</body>
</html>
直接存成HTML檔,執行瀏覽器就可以看出來了。