0
我有以下形式:复选框选中值去文本框(切换等)
<form action="" method="get">
<input name="form1" type="radio" onclick="document.forms[0].testbox.value='0.00'; "/>
<input name="form1" type="radio" onclick="document.forms[0].testbox.value='1.00'; "/>
<input name="" type="checkbox" value="" onclick="document.forms[0].testbox2.value='1.00'; "/>
<input name="testbox" type="text" value="0.00"/>
<input name="testbox2" type="text" value="0.00"/>
</form>
当单选按钮改变,在文本框中的值也会发生变化,从0.00到1.00回到1.00等。
我想要做的周期/复选框同样的事情 - 当点击了testbox2价值应该成为1.00,当未点击应该回到0.00 ..
同样的onclick编码不工作?想法?
谢谢
发表意见之后试过这种..但是不工作?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function checkboxClick() {
var textbox = document.forms[0].testbox2;
textbox.value = (textbox.value == 0) ? '1.00' : '0.00';
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<form action="" method="get">
<input name="form1" type="radio" onclick="document.forms[0].testbox.value='0.00'; "/>
<input name="form1" type="radio" onclick="document.forms[0].testbox.value='1.00'; "/>
<input name="" type="checkbox" value="" onclick="document.forms[0].testbox2.value='1.00'; "/>
<input name="testbox" type="text" />
<input name="testbox2" type="text" value="0.00"/>
</form>
<body>
</body>
</html>
忘了补充这一变化的onclick的建议如下变化..谢谢你..完美..
java?你的意思是JavaScript? –
对不起.. ..会改变..谢谢.. – user718359
canadiancreed刚换了我..谢谢.. – user718359