如何将几个select的值合并
原来是:
<input name= "all " type= "text " id= "all " maxlength= "12 ">
现在用几个select来代替,如何是下面的程序实现像上面的一样。
就是如何将a、b、c、d的四个select值合并成all。
<select name= "a " id= "a ">
<option value= "1 "> 1 </option>
<option value= "2 "> 2 </option>
<option value= "3 "> 3 </option>
<option value= "4 "> 4 </option>
<option value= "5 "> 5 </option>
<option value= "6 "> 6 </option>
<option value= "0 "> 7 </option>
</select>
<select name= "living_rooms " id= "b ">
<option value= "0 "> 0 </option>
<option value= "1 "> 1 </option>
<option value= "2 "> 2 </option>
<option value= "3 "> 3 </option>
<option value= "4 "> 4 </option>
</select>
<select name= "bathrooms " id= "c ">
<option value= "0 "> 0 </option>
<option value= "1 "> 1 </option>
<option value= "2 "> 2 </option>
<option value= "3 "> 3 </option>
<option value= "4 "> 4 </option>
</select>
<select name= "exposure " id= "d ">
<option> =选择= </option>
<option value= "1 "> 1 </option>
<option value= "2 "> 2 </option>
<option value= "3 "> 3 </option>
<option value= "4 "> 4 </option>
<option value= "5 "> 5 </option>
<option value= "6 "> 6 </option>
<option value= "7 "> 7 </option>
<option value= "8 "> 8 </option>
<option value= "9 "> 9 </option>
<option value= "10 "> 10 </option>
</select>
</td>
------解决方案-------------------- <html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> </title>
<script type= "text/javascript ">
function changes()
{
var arr = new Array();
arr.push(document.getElementById( "a ").value);
arr.push(document.getElementById( "b ").value);
arr.push(document.getElementById( "c ").value);
arr.push(document.getElementById( "d ").value);
document.getElementById( "all ").value = arr.join( " ");
}
window.onload = changes;
</script>
</head>
<body>
<form>
<input name= "all " type= "text " id= "all " maxlength= "12 ">
<select name= "a " id= "a " onchange= "changes() ">
<option value= "1 "> 1 </option>
<option value= "2 "> 2 </option>
<option value= "3 "> 3 </option>
<option val