【www.gdgbn.com--js教程】

js操作iframe的一些知识
1. 打印iframe
eg. framename.document.execcommand("print");
2. 获取iframe
eg. var ifr_window = window.frames["framename"];
3. 获取iframe中的元素
eg1. 将iframe中id为elementid 的元素置为不显示:
var ifr_window = window.frames["framename"];
ifr_window.elementid.style.display = "none";
eg2. 获取iframe中id为listtable的表格

看一下关于js iframe操作实例

方案一:用iframe的name属性定位

onclick="document.frames("ifrmname").location.reload()">

  或

onclick="document.all.ifrmname.document.location.reload()">

  方案二:用iframe的id属性定位

onclick="ifrmid.window.location.reload()">

  终极方案:当iframe的src为其它网站地址(跨域操作时)

onclick="window.open(document.all.ifrmname.src,"ifrmname","")">

看一下父窗口页面

 

   
     
  <script   type="text/网页特效">   
  
  function say() {
   alert("parent.html------>i"m at parent.html");
   } 
  
  function callchild()
  {   
   //document.frames("myframe").f1();
   myframe.window.say();
  }   
  </script>   
     
    
       
    
   
     
     

本文来源:http://www.gdgbn.com/wangyezhizuo/29520/