【发布时间】:2013-07-04 18:53:38
【问题描述】:
我正在处理单选按钮我需要在一个按钮单击时填充六个文本框的值我在 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>
【问题讨论】:
-
填充在哪里??点击计算它正在工作
-
详细说明。我无法理解您的问题
-
使用值填充文本框,例如如果用户在使用的单位数中输入 3,然后单击计算按钮,所有六个实际结果的文本框都填充 300
-
@Krishnanunni 帮我解决这个问题
-
@MoeedFarooqui 帮我解决这个问题
标签: php javascript jquery html ajax