<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
</head>
<body>
<select onChange="selB.options[selectedIndex].selected=true">
<option>testA1</option>
<option>testA2</option>
<option>testA3</option>
<option>testA4</option>
<option>testA5</option>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;
<select id="selB">
<option>testB1</option>
<option>testB2</option>
<option>testB3</option>
<option>testB4</option>
<option>testB5</option>
</select>
</body>
</html>
这个代码选择第一个框 ,第2个框能同步,,那么怎么让选择第2个框的数据,第1个框页跟着变化同步

解决方案 »

  1.   


    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <title>标题页</title>
    </head>
    <body>
    <select id="selA" onChange="selB.options[selectedIndex].selected=true">
    <option>testA1</option>
    <option>testA2</option>
    <option>testA3</option>
    <option>testA4</option>
    <option>testA5</option>
    </select>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <select id="selB" onchange="selA.options[selectedIndex].selected=true">
    <option>testB1</option>
    <option>testB2</option>
    <option>testB3</option>
    <option>testB4</option>
    <option>testB5</option>
    </select>
    </body>
    </html>
      

  2.   

    <select id="selA" onChange="selB.selectIndex=selA.selectIndex">
    </select>
    <select id="selB" onChange="selA.selectIndex=selB.selectIndex">
    </select>