parent.main.hehe1();
或者
top.main.hehe1();

解决方案 »

  1.   

    index.html
    <frameset cols="150,*">
        <frame name="left" src="left.html">
        <frame name="main" src="main.html">
    </frameset>left.html
    <script type="text/javascript">
    function callMainFunction()
    {
      parent.main.hehe();
    }
    </script>
    <input type="button" onclick="callMainFunction()" />main.html
    <script type="text/javascript">
    function hehe()
    {
      alert("hehe");
    }
    </script>
      

  2.   

    top表示最顶层
    parent表示父层
    由于你目前在b页面,所以你不能访问到a页面元素
    此时你用top或者parent就可以访问a页面和b页面元素了
      

  3.   

    frame 页
    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script src="aa.js" type="text/javascript"></script>
    </head><frameset rows="80,*" cols="*" frameborder="no" border="0" framespacing="0">
      <frame src="topFrame.html" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
      <frameset cols="80,*" frameborder="no" border="0" framespacing="0">
        <frame src="leftFrame.html" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />
        <frame src="mainFrame.html" name="mainFrame" id="mainFrame" title="mainFrame" />    
      </frameset>
    </frameset>
    <noframes><body>
    </body>
    </noframes></html>
    main 页<!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script src="aa.js" type="text/javascript" ></script>
    </head>
    <script>
    commit=function(){
        
                left.main.demo();
    }
    </script>
    <body>
    <input type="button" id="btn_test" value="test" onclick="commit();"/>
    </body>
    </html>
    left 页<!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script src="aa.js" type="text/javascript" ></script>
    <script>
        demo=function()
        {
            document.getElementById("txt_content").value="aaa";
        }
    </script>
    </head>
        <form name="aaa">
         <input type="text" id="txt_content" name="txtcontent"/>
         <label name="lbl_text" id="rrr" onclick="demo();">aaaa</label>
    </form>
    <body>
    </body>
    </html>启动 frame页面把两个页面都打开,我想在main 页调 left页函数,怎么调
      

  4.   

    我想在问个问题,从main里可以刷新left页面吗?
      

  5.   

    由于name="leftFrame"
    所以
    parent.leftFrame.demo()
      

  6.   

    我想在问个问题,从main里可以刷新left页面吗?
    ==========
    parent.leftFrame.location.reload()
      

  7.   

    能在js函数中向servlet提交吗
    把页面显示到main页里,
      

  8.   

    其实你可以把js函数写到公共访问文件中,用的时候一引用就好了,跳框架吊js会影响网页速度
      

  9.   

    11楼,
    common,A,Bjs写在common文件里,A页面调common文件的代码显示到B页面这样的还需要用到跨页面调用/显示等于还是用到parent