asp文本框自动即时计算,要求(a+b=c)(d+e=f)(a+d=g)
<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%><!doctypehtml><html><head><metacharset="gb2312"...
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><!doctype html><html><head><meta charset="gb2312"><title>无标题文档</title></head><body><form name="form1" method="post" action=""> <table width="100%" border="1"> <tr> <td><label for="a"></label> <input type="text" name="a" id="a"></td> <td><label for="b"></label> <input type="text" name="b" id="b"></td> <td><label for="c"></label> <input type="text" name="c" id="c"></td> </tr> <tr> <td><label for="d"></label> <input type="text" name="d" id="d"></td> <td><label for="e"></label> <input type="text" name="e" id="e"></td> <td><label for="f"></label> <input type="text" name="f" id="f"></td> </tr> <tr> <td><label for="g"></label> <input type="text" name="g" id="g"></td> <td><label for="h"></label> <input type="text" name="h" id="h"></td> <td> </td> </tr> </table></form></body></html>
展开
1个回答
展开全部
<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>无标题文档</title>
<script>
window.onload=function(){
var a=document.getElementById("a");
var b=document.getElementById("b");
var c=document.getElementById("c");
var d=document.getElementById("d");
var e=document.getElementById("e");
var f=document.getElementById("f");
var g=document.getElementById("g");
var h=document.getElementById("h");
a.oninput=b.oninput=d.oninput=e.oninput=
a.onpropertychange=b.onpropertychange=
d.onpropertychange=e.onpropertychange=function(){
c.value=Number(a.value)+Number(b.value);
f.value=Number(d.value)+Number(e.value);
g.value=Number(a.value)+Number(d.value);
h.value=Number(b.value)+Number(e.value);
}
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<table width="100%" border="1">
<tr>
<td><label for="a"></label><input type="text" name="a" id="a"></td>
<td><label for="b"></label><input type="text" name="b" id="b"></td>
<td><label for="c"></label><input type="text" name="c" id="c"></td>
</tr>
<tr>
<td><label for="d"></label><input type="text" name="d" id="d"></td>
<td><label for="e"></label><input type="text" name="e" id="e"></td>
<td><label for="f"></label><input type="text" name="f" id="f"></td>
</tr>
<tr>
<td><label for="g"></label><input type="text" name="g" id="g"></td>
<td><label for="h"></label><input type="text" name="h" id="h"></td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询