日期:2014-05-16 浏览次数:20477 次
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>11</title>
</head>
<body>
<SCRIPT language="javascript">
function SumNum()
{
var sumValue
c=eval(cc.value);
a=eval(aa.value);
b=eval(bb.value);
if (isNaN(a))
{a=0}
if (isNaN(b))
{b=0}
if (isNaN(c))
{b=0}
sumValue = a+b+c;
self['zong'].value =sumValue;
}
</script>
<select id="cc">
<option value="60" "SumNum();">值是60</option>
<option value="0" "SumNum();">值是0</option>
</select>
<input id="aa" type="text" size="20" onkeyup="value=value.replace(/[^\d\.]/g,'');SumNum();">
<input id="bb" type="text" size="20" onkeyup="value=value.replace(/[^\d\.]/g,'');SumNum();">
<input id="zong" type="text" size="20">
</body>
</html>
楼主去学下基础的dhtml先。。
<SCRIPT language="javascript">
function SumNum() {
var sumValue
c =parseInt( document.getElementById('cc').value)
a = parseInt( document.getElementById('aa').value)
b = parseInt(document.getElementById('bb').value)
if (isNaN(a))
{ a = 0 }
if (isNaN(b))
{ b = 0 }
if (isNaN(c))
{ b = 0 }
sumValue = a + b + c;
document.getElementById('zong').value = sumValue;
}
</script>
<select id="cc" onchange="SumNum()">
<option value="60">值是60</option>
<option value="0">值是0</option>
</select>
<input id="aa" type="text" size="20" onkeyup="value=value.replace(/[^\d\.]/g,'');SumNum();">
<input id="bb" type="text" size="20" onkeyup="value=value.replace(/[^\d\.]/g,'');SumNum();">
<input id="zong" type="text" size="20">
<html>
<head>
<title>11</title>
</head>
<body>
<SCRIPT language="javascript">
function SumNum()
{