在页面中含有frameset方式布局时,如果各个frame之间要相互访问的话:

var getLeftFrameValue=parent.frames["leftFrame"].document.getElementById("txtleft").value;

在页面中含有iframe方式布局时,此时访问iframe中元素时:
var getLeftFrameValue=document.getElementById("leftiframe").contentWindow.document.getElementById("txtleft").value;
访问frame中的是不存在contentWindow对象的,而要访问iframe中dom是必须要经过contentWindow对象的。
因为在iframe中document.getElementById("leftiframe").contentWindow表示要获取leftiframe的window对象.
 

相关文章:

  • 2022-02-27
  • 2022-02-18
  • 2022-12-23
  • 2021-12-10
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-08-24
  • 2021-08-22
  • 2021-10-15
相关资源
相似解决方案