日期:2014-05-16  浏览次数:20437 次

如何在select下拉菜单改变时.同时改变几个input的值
<select   onchange= "document.all.remarkInput.value=this[this.selectedIndex].remark ">
<option   value= " "   remark= " "> </option>
<option   value= "1 "   remark= "A1 "> A </option>
<option   value= "2 "   remark= "B1 "> B </option>
<option   value= "3 "   remark= "C1 "> C </option>
<option   value= "4 "   remark= "D1 "> D </option>
<option   value= "5 "   remark= "E1 "> E </option>
</select>
<input   name=remarkInput   value= " "   readonly>
像上面的功能.但是要有多个input.而且每个input的值不同.

------解决方案--------------------
<select onchange= "change(this.value) ">
<option value= " " remark= " "> </option>
<option value= "1 " remark= "A1 "> A </option>
<option value= "2 " remark= "B1 "> B </option>
<option value= "3 " remark= "C1 "> C </option>
<option value= "4 " remark= "D1 "> D </option>
<option value= "5 " remark= "E1 "> E </option>
</select>
<input name=remarkInput value= " " readonly>
<script>
function change(value)
{
document.getElementById( "remarkInput ").value=value;
}
</script>

在Chang()里面按例添加就行了,当然还可以判断是否非空
------解决方案--------------------

<select onchange= "change(this.value) ">
<option value= " " remark= " "> </option>
<option value= "1 " remark= "A1 "> A </option>
<option value= "2 " remark= "B1 "> B </option>
<option value= "3 " remark= "C1 "> C </option>
<option value= "4 " remark= "D1 "> D </option>
<option value= "5 " remark= "E1 "> E </option>
</select>
<input name=remarkInput value= " " readonly>
<script>
function change(value)
{
for(i=0;i <document.getElementsByTagName( 'text ').length;i++){
document.getElementsByTagName( 'text ')[i].value=value;
}
}
</script>
------解决方案--------------------
<select onchange= "a(this) ">

function a(s)
{
v = s.options[s.selectedIndex].value
if( v == "1 ")
{
document.getElementById( "inputID ").value= "1,2,3 "
}
if( v == "2 ")
{
document.getElementById( "inputID ").value= "a,b,c "
}
}
------解决方案--------------------
<select onchange= "document.all.remarkInput.value=this[this.selectedIndex].remark;document.all.remark2Input.value=this[this.selectedIndex].remark2; ">
<option value= " " remark= " " remark2= " "> </option>
<option value= "1 " remark= "A1 " remark2= "天 "> A </option>
<option value= "2 " remark= "B1 " remark2= "地 "> B </option>
<option value= "3 " remark= "C1 &quo