求助:一个关于onclick事件的问题

liweilin 2006-04-22 09:36:51
在机子上执行没有反应:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="vbscript" >

sub caculate
dim x,y,z,a
x=cdbl(form1.value1.value)
y=cdbl(form1.value2.value)
a=form1.operator.value
select case a
case "*"
z=x*y
case "+"
z=x+y
case "-"
z=x+y
case "/"
z=x/y
end select
z=form1.value3.value
end sub
</script>
</head>

<body>
<center>
<form name="form1" action="" method="post">
<table border="1" bgcolor="#993366"><tr>
<td><input name="value1" type="text" size="5"></td>
<td><select name="operator" size="1">
<option value="*">*</option>
<option value="+">+</option>
<option value="-">-</option>
<option value="/">/</option>
</select>
</td>
<td><input name="value2" type="text" size="5"></td>
<td><input name="upto" type="button" value="=" size="20" onClick="caculate"></td>
<td><input name="value3" type="text" size="5" ></td>
</tr>
</table>
</form>
</center>
</body>
</html>
...全文
478 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
AppleBBS 2006-06-16
  • 打赏
  • 举报
回复
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="vbscript" >

sub caculate
dim x,y,z,a
x=cdbl(form1.value1.value)
y=cdbl(form1.value2.value)
a=form1.operator.value
select case a
case "*"
z=x*y
case "+"
z=x+y
case "-"
z=x-y
case "/"
z=x/y
end select
form1.value3.value = z
end sub
</script>
</head>

<body>
<center>
<form name="form1" action="" method="post">
<table border="1" bgcolor="#993366"><tr>
<td><input name="value1" type="text" size="5"></td>
<td><select name="operator" size="1">
<option value="*">*</option>
<option value="+">+</option>
<option value="-">-</option>
<option value="/">/</option>
</select>
</td>
<td><input name="value2" type="text" size="5"></td>
<td><input name="upto" type="button" value="=" size="20" onClick="caculate"></td>
<td><input name="value3" type="text" size="5" ></td>
</tr>
</table>
</form>
</center>
</body>
</html>
wanghui0380 2006-06-05
  • 打赏
  • 举报
回复
可以考虑使用 eval
这样代码可以简化很多
三仙半 2006-06-05
  • 打赏
  • 举报
回复
moodboy1982(自由人)( 没有绝对永恒的爱情,只有我执着的追求):VBS为什么不能做客户端脚本?我们都用。只能说VBS和其他脚本各有所长。
三仙半 2006-06-03
  • 打赏
  • 举报
回复
把z=form1.value3.value改成form1.value3.value=z就可以了
fengyeng 2006-05-31
  • 打赏
  • 举报
回复
路过!
xingmaohai 2006-05-29
  • 打赏
  • 举报
回复
PaulLeder正解
PaulLeder 2006-05-21
  • 打赏
  • 举报
回复
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="vbscript" >

sub caculate()
dim x,y,z,a
x=cdbl(form1.value1.value)
y=cdbl(form1.value2.value)
a=form1.operator.value
select case a
case "*"
z=x*y
case "+"
z=x+y
case "-"
z=x-y
case "/"
z=x/y
end select
form1.value3.value=z
end sub
</script>
</head>

<body>
<center>
<form name="form1" action="" method="post">
<table border="1" bgcolor="#993366"><tr>
<td><input name="value1" type="text" size="5"></td>
<td><select name="operator" size="1">
<option value="*">*</option>
<option value="+">+</option>
<option value="-">-</option>
<option value="/">/</option>
</select>
</td>
<td><input name="value2" type="text" size="5"></td>
<td><input name="upto" type="button" value="=" size="20" onClick="caculate()"></td>
<td><input name="value3" type="text" size="5" ></td>
</tr>
</table>
</form>
</center>
</body>
</html>
平民校长 2006-05-20
  • 打赏
  • 举报
回复
你原来的代码正常的呀!请检查是否你的iis配置问题
tigerwen01 2006-04-28
  • 打赏
  • 举报
回复
你那样高肯定没有反应的。修改一下:
sub caculate_onClick
...
end sub

<input name="caculate" type="button" value="=">
阿米果 2006-04-27
  • 打赏
  • 举报
回复
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="vbscript" >

sub caculate
dim x,y,z,a
x=cdbl(form1.value1.value)
y=cdbl(form1.value2.value)
a=form1.operator.value
select case a
case "*"
z=x*y
case "+"
z=x+y
case "-"
z=x+y
case "/"
z=x/y
end select
form1.value3.value=z
end sub
</script>
</head>

<body>
<center>
<form name="form1" action="" method="post">
<table border="1" bgcolor="#993366"><tr>
<td><input name="value1" type="text" size="5"></td>
<td><select name="operator" size="1">
<option value="*">*</option>
<option value="+">+</option>
<option value="-">-</option>
<option value="/">/</option>
</select>
</td>
<td><input name="value2" type="text" size="5"></td>
<td><input name="upto" type="button" value="=" size="20" onClick="vbscript:caculate"></td>
<td><input name="value3" type="text" size="5" ></td>
</tr>
</table>
</form>
</center>
</body>
</html>
moodboy1982 2006-04-22
  • 打赏
  • 举报
回复
用VBSCRIPT做客户端的脚本语言?失败!!



----------个性签名-----------
http://www.esoftnow.com/bbs
技术论坛,手把手教你起飞!

4,008

社区成员

发帖
与我相关
我的任务
社区描述
它是一种微软环境下的轻量级的解释型语言,它使用COM组件、WMI、WSH、ADSI访问系统中的元素,对系统进行管理。
社区管理员
  • vbScript社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧