<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
    $(function(){   
            
                  $("iframe").contents().find("html body").append("<p>xxxxxxxxxxxxxxxxxxxxxxxx<p>");    
            
                });   
     
</script>
</head>
<body>
<div>
 
  <iframe  src="http://www.baidu.com" width="1000" height="600" ></iframe>
  
</div>
<div> </div>
</body>
</html>问题:为何append()没有作用?

解决方案 »

  1.   

    (function(){   
        
      $("iframe",document.body).append("<p>xxxxxxxxxxxxxxxxxxxxxxxx<p>");   
        
      }); 
      

  2.   

    “<iframe src="http://www.baidu.com" width="1000" height="600" ></iframe>”????baidu “跨域”
      

  3.   

    <iframe src="xx.html" width="1000" height="600"> 这样也不行
      

  4.   

    你是想给baidu的页面加<p>xxxxxxxxxxxxxxxxxxxxxxxx<p>
    ??
      

  5.   

    那是个例子 我是想给本地的页面加 本地的页面是这样的 
    $("iframe").contents().find("html body").append("<textarea></textarea>");   <iframe src="show.html" width="1000" height="600" ></iframe>
     
      

  6.   

    iframe中能append<p>么?即使打了也显示不出来的吧~还是说你要再show.html里面加p元素呢?这不就是要传参数去show.html了么~
      

  7.   

    $("iframe").after("@@@@@@@@@@@@@@@@@@@@@@");