我正在处理单选按钮我需要在一个按钮上填充六个文本框的值我在 js fiddle 中显示 mu 问题这里是链接:http: //jsfiddle.net/sKrhY/请帮我解决这个问题。一件事我想提一下,在检查单选按钮a
b
c
时会出现一个文本框,用户可以在其中输入单击calculate
按钮时的值,该值也应该显示。请帮助我,这是我的代码:
<script type="text/javascript">
function toggle(value)
{
if(value=='show')
document.getElementById('mytext').style.visibility='visible';
else
document.getElementById('mytext').style.visibility='hidden';
}
</script>
<script>
function doCalc(){
var input_value = parseInt( document.getElementById("value_input").value );
document.getElementById("value_output").value = 100 * input_value;
document.getElementById("value_output1").value = 100 * input_value;
document.getElementById("value_output2").value = 100 * input_value;
document.getElementById("value_output3").value = 100 * input_value;
document.getElementById("value_output4").value = 100 * input_value;
document.getElementById("value_output5").value = 100 * input_value;
document.getElementById("value_output6").value = 100 * input_value;
return false;
};
document.getElementById("calc_button").onclick = doCalc;
</script>
<form method="POST" name="form1">
No of Units (kwh) Used :<input type="text" id="value_input" value="123"></input><br/>
select your categaory
<input type="radio" name="myradio" checked="checked" onclick="toggle('hide');" />domestic
<input type="radio" name="myradio" checked="checked" onclick="toggle('show');">a
<input type="radio" name="myradio" checked="checked" onclick="toggle('show');">b
<input type="radio" name="myradio" checked="checked" onclick="toggle('show');">c
connected loads(kwh)
<input type="text" name="mytext" id="mytext">
Actual <input type="text" id="value_output"></input><br/>
tax <input type="text" name="text2" id="value_output1" />
Elec <input type="text" name="text3" id="value_output2" />
Charges <input type="text" name="text4" id="value_output3" />
Amount <input type="text" name="text5" id="value_output4" />
Govt <input type="text" name="text6" id="value_output5" />
result <input type="text" name="text7" id="value_output6" />
<input id="calc_button" type="submit" name="Calculate" value="Calculate"></input>
</form>