首页 > Web开发 > 详细

网页开发中调用iframe中的函数或者是dom元素

时间:2014-11-03 23:49:40      阅读:274      评论:0      收藏:0      [点我收藏+]

iframe中的代码

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>By DragonDean</title>
<script>
function ziti(zt){
    alert(你成功调用了DragonDean写的函数了!);
}
</script>
</head>

<body>
    this is a dragondean‘s test page !
</body>
</html>

 

调用iframe中的ziti()函数

window.frames[0].ziti();

获取iframe中body的代码

$("iframe").contents().find(‘body‘).html()

就做个记录,怕以后又遇到同样的问题还得到处找资料。更伤心的是网上好多资料是不可靠的。

网页开发中调用iframe中的函数或者是dom元素

原文:http://www.cnblogs.com/dragondean/p/iframe-function-tag.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!