码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2014-11-03 23:52:17      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   color   ar   sp   div   on   

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元素

标签:style   blog   http   io   color   ar   sp   div   on   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!