index.html:
<html>
<body>
<div>
<iframe id="a" stc=a.html>
</iframe>
</div>
</body>
</html>
a.html:
<html>
<frameset>
<frame src="aa.html" id="aa">
<frame src="bb.html" id="bb">
</frameset>
</html>aa.html:
<html>
<body>
<div>
<input id="aaa" name="aaa" value="" type="text">
</div>
</body>
</html>
要求在index.html页面用JS实现 获取到aa.html中input项的value值。

解决方案 »

  1.   

    document.getElementById("aaa").value;
    不行吗?
      

  2.   

    document.getElementById("a").document.getElementById("aa").document.getElementById("aaa").value
      

  3.   

    window.frames["a"].document.getElementById("aa").document.getElementById("aaa").value;
      

  4.   

    function test(){
    if(document.getElementById("a").contentWindow.document.getElementById("aa") == null){
    o = setTimeout("test()", 1000);
    }else{
    clearTimeout(o);
    document.getElementById("a").contentWindow.document.getElementById("aa").contentWindow.document.getElementById("aaa").value = 123;
    }
    }
    test();
      

  5.   

    <iframe id="a" stc=a.html>stc?
      

  6.   


    通过document.getElementById("a").contentWindow.document.getElementById("aa").contentWindow.document.getElementById("aaa").value这种方式已经解决....谢谢