<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>计算器</title>
</head>
<body>
<script language="vbscript">
on error resume next
dim expression
sub addv(cv)
cv=trim(cv)
if( (cv="+") or (cv="-") or (cv="*") or (cv="\")) then
document.f1.resu.value=""
if (right(expression,1)="" or right(expression,1)="+" or right(expression,1)="-" or right(expression,1)="*" or right(expression,1)="\" )then
msgbox("这样无法计算")
expression=""
exit sub
end if
end if
expression=expression&cv
document.f1.resu.value=expression
end sub
sub compute()
document.f1.resu.value=eval(expression)
expression=document.f1.resu.value
end sub
sub crt()
expression=""
document.f1.resu.value=""
end sub
</script>
<form name="f1">
<div align="center">
<table width="200" border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4" align="center">青蛙计算机</td>
</tr>
<tr>
<td colspan="4"><div align="center">
<input type="text" name="resu">
</div></td>
</tr>
<tr>
<td><div align="center">
<input type="button" value=" 1 " name="v1" onClick="addv('1')">
</div></td>
<td><div align="center">
<input type="button" value=" 2 " name="v2" onClick="addv('2')">
</div></td>
<td><div align="center">
<input type="button" value=" 3 " name="v3" onClick="addv('3')">
</div></td>
<td><div align="center">
<input type="button" value=" + " name="plus" onClick="addv('+')">
</div></td>
</tr>
<tr>
<td><div align="center">
<input type="button" value=" 4 " name="v4" onClick="addv('4')">
</div></td>
<td><div align="center">
<input type="button" value=" 5 " name="v5" onClick="addv('5')">
</div></td>
<td><div align="center">
<input type="button" value=" 6 " name="v6" onClick="addv('6')">
</div></td>
<td><div align="center">
<input type="button" value=" - " name="minu" onClick="addv('-')">
</div></td>
</tr>
<tr>
<td><div align="center">
<input type="button" value=" 7 " name="v7" onClick="addv('7')">
</div></td>
<td><div align="center">
<input type="button" value=" 8 " name="v8" onClick="addv('8')">
</div></td>
<td><div align="center">
<input type="button" value=" 9 " name="v9" onClick="addv('9')">
</div></td>
<td><div align="center">
<input type="button" value=" * " name="mult" onClick="addv('*')">
</div></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="button" value=" = " name="eqal" onClick="compute()">
</div></td>
<td><input type="button" value=" CR " name="cr" onClick="crt()"></td>
<td><div align="center">
<input type="button" value=" \ " name="divi" onClick="addv('\')">
</div></td>
</tr>
</table>
</div>
</form>
</body>
</html>
一个计算器的例子,在文本框里输入数字后 用鼠标去掉 在输入数字,去掉的数字又出来了 请问怎么修改