请教各位高手,我有一个frame框架的网页,左边是菜单,右边是显示的网页
显示一直都正常,点了左边的链接,新页面都是在右边出来
但是,右边有一个页我用javascript 控制了几个表格显示和隐藏,只要这个脚本执行过之后,再点框架左边的链接,就全都打开新窗口,很郁闷~请各位高手帮帮忙,谢谢
<SCRIPT language=JavaScript>
function hideAll()
{
document.getElementById("jz").style.display="none";
document.getElementById("gn").style.display="none";
document.getElementById("ys").style.display="none";
document.getElementById("al").style.display="none";
document.getElementById("jzi").style.background="url(../images2/bgbl.gif)";
document.getElementById("gni").style.background="url(../images2/bgbl.gif)";
document.getElementById("ysi").style.background="url(../images2/bgbl.gif)";
document.getElementById("ali").style.background="url(../images2/bgbl.gif)";
}function showFun(id)
{
 if(id==1) name="jz";
 if(id==2) name="gn";
 if(id==3) name="ys";
 if(id==4) name="al";
  hideAll();
  var imgname=name+"i";
  //var imgurl="g"+id+"1.gif";
  var imgurl="bggr.gif";
  document.getElementById(name).style.display="block";
  document.getElementById(imgname).style.background="url(../images2/"+imgurl+")";
}
</script>

解决方案 »

  1.   

    只要左边的窗口打开的链接目标设置了在右边打开就没有问题。
    左:
    <a href="a.html" target="main">open</a>
    main是iframe的name
    右:
    <iframe name="main"/>
    不知道你是什么情况,怪!
      

  2.   

    有想试试的哥们,可以用下边的代码试试,这个就是框架里右边网页的代码<HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=gb2312"><SCRIPT language=JavaScript>
    function hideAll()
    {
    document.getElementById("jz").style.display="none";
    document.getElementById("gn").style.display="none";
    document.getElementById("ys").style.display="none";
    document.getElementById("al").style.display="none";
    document.getElementById("jzi").style.background="url(../images2/bgbl.gif)";
    document.getElementById("gni").style.background="url(../images2/bgbl.gif)";
    document.getElementById("ysi").style.background="url(../images2/bgbl.gif)";
    document.getElementById("ali").style.background="url(../images2/bgbl.gif)";
    }function showFun(id)
    {
     if(id==1) name="jz";
     if(id==2) name="gn";
     if(id==3) name="ys";
     if(id==4) name="al";
      hideAll();
      var imgname=name+"i";
      //var imgurl="g"+id+"1.gif";
      var imgurl="bggr.gif";
      document.getElementById(name).style.display="block";
      document.getElementById(imgname).style.background="url(../images2/"+imgurl+")";
    }</script></HEAD>
    <BODY>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="6" height="26" valign="bottom"  background="../images2/bgbl.gif"></td>
            <td height="26" align="center" background="../images2/bggr.gif" id="jzi" style="CURSOR: hand"  onMouseOver="showFun(1)">111</td>
            <td height="26" align="center" background="../images2/bgbl.gif" id="gni" style="CURSOR: hand"  onMouseOver="showFun(2)">222</td>
            <td height="26" align="center" background="../images2/bgbl.gif" id="ysi" style="CURSOR: hand"  onMouseOver="showFun(3)">333</td>
            <td height="26" align="center" background="../images2/bgbl.gif" id="ali" style="CURSOR: hand"  onMouseOver="showFun(4)">444</td>
            <td width="6" height="26" valign="bottom" background="../images2/bgbl.gif"></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="99" valign="top"><table id="jz" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="71">111</td>
          </tr>
        </table>
          <table id="gn"  width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="DISPLAY: none">
            <!-- style="DISPLAY: none"-->
            <tr>
              <td>222</td>
            </tr>
          </table>
          <table  id="ys" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="DISPLAY: none">
            <!-- style="DISPLAY: none" -->
            <tr>
              <td>444</td>
            </tr>
          </table>
          <table id="al" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="DISPLAY: none">
            <!-- style="DISPLAY: none" -->
            <tr>
              <td>333</td>
            </tr>
          </table></td>
      </tr>
    </table>
    </BODY></HTML>
      

  3.   

    以前也遇到过这样的问题 后来不知道怎么就再也没碰到过了。JS没有问题,试试给每个页面加标准引用 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 或者看看用的还是IE6吗 如果是就升级下吧。也是猜想 嫌麻烦就不用理我。
      

  4.   

    自己搞定了
    在function showFun(id)里边加了一句:
    var name = "";
    唉~