<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<iframe src="http://www.baidu.com" id="xx"></iframe>
<script>
document.all.xx.onload=function(){alert("here");}
</script>
</body>
</html>

解决方案 »

  1.   

    但是为什么xx.onload不行呢?
    我进行了alert(xx) 得到 [object] 说明xx对象存在的呀。
    为什么要用document.all.xx.onload 才可以呢?
      

  2.   

    因为你写错了xx.onload = pro;
    应该是xx.onload = pro();
      

  3.   

    <iFrame src="http://www.baidu.com/" id="xx"></iFrame>
    <script language="javascript">
    document.all.xx.onload = pro;
    function pro(){
      alert('xx is ok');
      return true;
    }
    </script>就这样用吧。
    document.all.xx.onload = pro;
    xx.onload = pro();
    都可以,俺也没有弄明白。
      

  4.   

    re楼上:
    xx.onload = pro();这是不行的,网页打开就执行了函数,而不是等xx被加载完后执行。
      

  5.   

    document.all.xx.onload=function(){alert("here");}
    这个是可以的,但是你要操作iframe里面页面的元素是不可以的。这个就会弹出没有权限。
    如果子页面也是你自己写的,你可以在子页面中<body>的onload函数中写