私人领地

javascript的console.log用法

f1.html代码

<iframe id="frame2" name="frame1" src="ww.html"></iframe>
<script type="text/javascript">
    function ss(){
        console.log($('#frame1'))   // 打印信息
        $f = $('#frame2')[0].contentDocument.documentElement.innerText;  // 获取子窗口内容信息
        alert($f);
    }
    setTimeout(ss,3000);
</script>

ww.html代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
1111
</body>
</html>

 

使用  console.log($('#frame1'))  查看参数

获取值的方法

$f = console.log($('#frame1')[0].contentDocument.documentElement.innerHTML);

$f = console.log($('#frame1')[0].contentDocument.documentElement.innerText);

$f = $('#frame2')[0].contentDocument.documentElement.innerText;

 

posted @ 2016-12-30 19:16  狂奔的蜗牛Snails  阅读(870)  评论(0编辑  收藏  举报