提个问题
<iframe src="test.html" id="test" width="100" height="100">
请问,是否可以在 test.html 中 使用js修改 这个id为test的height值?如何操作。

解决方案 »

  1.   

    window.parent.document.getElementById("test").style.height = xxx;
      

  2.   

    <script type='text/javascript'>
     var test = parent.window.document.getElementById("test");
     alert(test.id);
    </script>
      

  3.   

    window.parent.document.getElementById("test").style.height="100px"
      

  4.   

    this.parent.bodyFrame.height 试试
      

  5.   

    同域可以,不同域时不可以
    parent.document.getElementById('test').style.height="2000px";
      

  6.   

    #2楼(cloudgamer) 的理解是对的,但是代码无效,我现在就是这么写的。并且又重新写了一个测试,无效。无法改变height的值。#3楼 (liubangls) 的知识获取,这个是正常的。
      

  7.   


    要parent属性干什么哦?
    这个iframe不是本来就在这个窗口呢?直接  document.getElementById("test").style.height = xxx;
    不就可以了嘛?