zoukankan      html  css  js  c++  java
  • FrametSet中各frame,iframe之间dom的访问

    在页面中含有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对象.
     
  • 相关阅读:
    HDU 1452
    POJ 1845
    POJ 2992
    POJ 3358
    POJ 3696
    POJ 3090
    POJ 2478
    2016大连网络赛 Football Games
    2016大连网络赛 Function
    2016大连网络赛 Sparse Graph
  • 原文地址:https://www.cnblogs.com/hailexuexi/p/2072084.html
Copyright © 2011-2022 走看看