左右俩个框架,右框架的名称叫right,
下面的链接在左边的框架中,通过点击链接在右边的框架打开新网址
<a href="http://www.test.com" 
onClick="document.frames[’right’].location=this.href;return false">在名为right的框架中打开链接</a> 
现在有个问题请问如何修改下面下拉列表使得下拉列表中链接在右边的框架中打开
<select name="select" id="select"  onChange="document.frames[’right’].location=this.options[this.selectedIndex].value;return false">
      <option selected >请选择你要的网站</option>
      <option value="http://51ditu.com/">我要地图51ditu</option>
      <option value="http://ditu.live.com/">LIVE地图</option>
    </select>
上面的代码报错啊,SOS如果修改上面代码不行,请问还有什么方法使得在左框架页中的下拉列表框中的链接点击后在右框架中打开

解决方案 »

  1.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <frameset rows="*" cols="256,*" framespacing="0" frameborder="1" border="1">
      <frame src="left.html" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />
      <frame src="" name="rightFrame" id="rightFrame" title="rightFrame" />
    </frameset>
    <noframes><body>
    </body>
    </noframes></html>
    left.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <script>
    function changeUrl(){
    var v = document.getElementById('select').value;
    parent.document.frames("rightFrame").location.href = v;
    }
    </script>
    <body>
    <select name="select" id="select"  onChange="changeUrl()">
          <option selected >请选择你要的网站 </option>
          <option value="http://51ditu.com/">我要地图51ditu </option>
          <option value="http://ditu.live.com/">LIVE地图 </option>
    </select> 
    </body>