主题:高手请进!
程序中,事件无法启动(即无效),请高手改一改,指导一下,谢谢!
<html><head>
<script language="JavaScript">
function f4(form, callingField)
{
if(callingField=="result"){
if(form.square.checked){
form.entry.value=Math.sqrt(form.result.value)
}
else{ form.entry.value=form.result.value/2
}
}
else {
if(form.square.checked)
{
form.result.value=(form.entry.value)*(form.entry.value)
}
else{ form.result.value=(form.entry.value)*2}
}
}
}
</script>
<head>
<body>
<form method=post>
输入的数:
<input type="text" name= "entry" value="0" onchange="f4(this.form,this.name)";><p>
选中求平方,否则求2倍:
<input type="checkbox" name="square" onchange="f4(this.form,this.name)";>
<br>结果是:
<input type="text" name="result" value="0" onchange="f4(this.form,this.name)" ;>
</form>
</body>
</html>
<html><head>
<script language="JavaScript">
function f4(form, callingField)
{
if(callingField=="result"){
if(form.square.checked){
form.entry.value=Math.sqrt(form.result.value)
}
else{ form.entry.value=form.result.value/2
}
}
else {
if(form.square.checked)
{
form.result.value=(form.entry.value)*(form.entry.value)
}
else{ form.result.value=(form.entry.value)*2}
}
}
}
</script>
<head>
<body>
<form method=post>
输入的数:
<input type="text" name= "entry" value="0" onchange="f4(this.form,this.name)";><p>
选中求平方,否则求2倍:
<input type="checkbox" name="square" onchange="f4(this.form,this.name)";>
<br>结果是:
<input type="text" name="result" value="0" onchange="f4(this.form,this.name)" ;>
</form>
</body>
</html>