输入文本我试图让在输入框中值单选按钮使用JavaScript
<form action="test()">
<input type="radio" name="typ" id="typ" value="ws" onfocus="test()" checked> ws
<input type="radio" name="typ" id="typ2" value="nb" onfocus="test()"> nb
<input type="radio" name="typ" id="typ3" value="za" onfocus="test()"> za
<input type="radio" name="typ" id="typ4" value="zb" onfocus="test()"> zb
</form>
在这里,从无线电框中的值是我的JS:
<script type="text/javascript">
function test(){
document.getElementById('serverid').value=document.getElementById('typ').value;
}
function test(){
document.getElementById('serverid').value=document.getElementById('typ2').value;
}
function test(){
document.getElementById('serverid').value=document.getElementById('typ3').value;
}
function test(){
document.getElementById('serverid').value=document.getElementById('typ4').value;
}
</script>
这是我的输入框和在这里,我将获得的单选值:
<input type="text" style="background-color:#ffffff" size="15" name="ID" id="serverid">
但事实如此每次ZB的输入框,但我会选择:-)我希望你unterstand我,我对我的英语很满意。
我希望有人能帮助我。
感谢:-)所以小问题^^ – Sebastian 2010-07-02 13:59:40