<div onlcick=getFrame(this)><iframe name="img" ...></div>

解决方案 »

  1.   

    用 this.img 为什么不行?
      

  2.   

    this.childNodes[0]; //可以this.childNodes['img']; //不可以
      

  3.   

    <div id="a" onlcick=getFrame(this)><iframe name="img" ...></div>document.getElementById("a").getElementsByTagName("IFRAME")[0] 我想这样应该也是可以的
      

  4.   

    当然. 你循环childNodes也是可以的
      

  5.   

    建议楼主用id
    HTML code<div onlcick=getFrame(this)><iframe id="img" ...></div>
    <script language="javascript">
    function getFrame(ele){
      ele.getElementById("img").src = "1.html";//用name就得这样ele.getElementsByName("img")[下标].src = "1.html";
    }