您的位置:首页 > 其它

chrome获取iframe元素

2014-03-06 11:16 302 查看
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<iframe src="demo.html" id="myFrame" name="myFrame" frameborder="0"></iframe>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(function(){
console.log($('#myFrame').contents().find('#btn').text());
})
</script>
</body>
</html>

要放在localhost下面使用
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息