<form name="cr1">
<select name="cr2" size=1>
    <option  value=ww2>&nbsp;&nbsp;6元区</option>
    <option  value=ww3>&nbsp;&nbsp;8元区</option>
    <option  value=ww4>&nbsp;&nbsp;10元区</option>
</select> 
<input type="button" value="Go!" onClick="location=document.cr1.cr2.options[document.cr1.cr2.selectedIndex].value"> 
</form><iframe src="url"  height="100%" width="100%" ></iframe>
从下拉菜单中选取一个,然后点go,在下面点的iframe中打开对应的网站,代码要怎么修改?谢谢

解决方案 »

  1.   

    给iframe一个ID。
    var select=document.getElementById("cr2");
    document.getElementById(iframeId).src="link?select="+select.options[select.selectedIndex].text
      

  2.   


    <form name="cr1"> 
    <select id="cr2" name="cr2" size=1> 
        <option value="ww2">&nbsp;&nbsp;6元区 </option> 
        <option value="ww3">&nbsp;&nbsp;8元区 </option> 
        <option value="ww4">&nbsp;&nbsp;10元区 </option> 
    </select> 
    <input type="button" value="Go!" onClick="document.getElementById('f1').src = document.getElementById('cr2').value;"> 
    </form> <iframe id="f1"  height="100%" width="100%" > </iframe> 
      

  3.   

    <form name="cr1"> 
    <select id="cr2" name="cr2" size=1> 
        <option value="www.yahoo.cn">&nbsp;&nbsp;6元区 </option> 
        <option value="www.sina.cn">&nbsp;&nbsp;8元区 </option> 
        <option value="www.g.cn">&nbsp;&nbsp;10元区 </option> 
    </select> 
    <input type="button" value="Go!" onClick="document.getElementById('f1').src = document.getElementById('cr2').value;"> 
    </form> <iframe id="f1"  height="100%" width="100%" > </iframe> 
    实际上打不开啊
      

  4.   

    value="要加http://就可以了,谢谢大家了