<!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>
"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>
解决方案 »
- 请问如何查找相有匹配的元素但不包含自身
- JS中SOAP的调用
- Jquery级联问题,数据后端已取到,在页面上展示不出来
- 如何decode htmlspecial字符
- 怎么点击一个链接文字(add)后.链接文字变为(ok).然后(OK是普通文本.不是链接文本)
- "‘document.all.testOpera.style.clip’为空或者不是对象"错误求助
- 简单问题,变量作为数组下标进行传值得问题!等待中.........
- 能够把下面的input中的值取出来吗(高手请回答)
- javascript能完成vbscript同样的功能吗?那么这段vbscript翻成 javascript该怎么翻呢?
- change事件中显示loading图层失效
- 类似于select的selectIndex方式的问题,在线等待
- 保存cookie时,如何让生成的文件名中没有"www."之类
我进行了alert(xx) 得到 [object] 说明xx对象存在的呀。
为什么要用document.all.xx.onload 才可以呢?
应该是xx.onload = pro();
<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();
都可以,俺也没有弄明白。
xx.onload = pro();这是不行的,网页打开就执行了函数,而不是等xx被加载完后执行。
这个是可以的,但是你要操作iframe里面页面的元素是不可以的。这个就会弹出没有权限。
如果子页面也是你自己写的,你可以在子页面中<body>的onload函数中写