to  :xiaoshi(java入门中....)(半知不解) 试了这个事件,但不会出发啊!!!

解决方案 »

  1.   

    fason(【阿信】) 不行啊!我是如下做的:无论 onbeforeunload还是onunload都不会触发tt()
    ……
      function tt(){
      alert('test');
    }
    ……  <iframe frameborder=0 id=i_main src="frame.aspx" width="97%" scrolling=no onabeforeupdate=tt()></iframe>
      

  2.   

    在XX2.html中
    <body onbeforeunload="alert()">
    试试
      

  3.   

    关键就是我需要在页面1中捕获,而不能在xx2.html中捕获!!  如何处理?
      

  4.   

    <script>
     function a(){
     alert()
     }
     </script> <iframe frameborder=1 id=i_main src="about:<body onbeforeunload='parent.a()'>" width="111"  onbeforeunload=alert()></iframe>
      

  5.   

    to (【阿信】) src="about:<body onbeforeunload='parent.a()'>"  这样写以后,我的目标页地址写哪啊?麻烦再讲清楚一点,我对javascript不熟悉。   我的目标页地址是frame.aspx 原来是这样写的: <iframe frameborder=0 id=i_main src="frame.aspx" width="97%" scrolling=no ></iframe>
      

  6.   

    我只是试验给你看可以能过parent.a()调用父页面的函数
    在frame.aspx中
    <body onbeforeunload="parent.a()">
      

  7.   

    我现在需求是这样的:子页面不固定,且编码人员也不固定,无法要求对方在在页面中(frame.aspx)加入<body onbeforeunload="parent.a()">,只能在当前包含iframe的页面中编码设置。
        
       这就是我上面所说“关键就是我需要在页面1中捕获,而不能在xx2.html中捕获!!”的原因!!
       
       能不在子页面中写任何代码而实现此功能吗?
      

  8.   

    div.html
    <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <meta name="Generator" content="EditPlus">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    </head><body onresize='alert("test")' >
    <input type=hidden value=0 name=aa >
    <div id=ff><iframe src='refresh.html' id=ifrm ></iframe></div>
    <script language="JavaScript">
    <!--
    function checkit(){
    if(aa.value==1){
    alert("&Ograve;&sup3;&Atilde;&aelig;&Ograve;&Ntilde;&frac34;&shy;&Euml;&cent;&ETH;&Acirc;");
    aa.value=0;
    }
    }
    setInterval("checkit()",2000)
    //-->
    </script>
    </body>
    </html>
    refresh.html
    <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <meta name="Generator" content="EditPlus">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    </head><body>
    al;skdfjal;sfjkaslkfjaslfkaskfasdfasfasdf;asdfl
    <script language="JavaScript">
    <!--
    function testit(){
    window.location.reload();
    parent.aa.value="1";
    }
    setInterval("testit()",2000);
    //-->
    </script>
    </body>
    </html>