RT

解决方案 »

  1.   

    document.getElementById('iframe1').contentWindow.document.getElementById('')
      

  2.   

    document.getElementById('iframe1').contentWindow.document.getElementById('btn1').onclick=function(){alert(123);return false;};
      

  3.   

    aa.html<input id="btn1" type="button" value="button" />
    bb.html<iframe id="iframe1" src="aa.html"></iframe>
    <script type="text/javascript">
    document.getElementById('iframe1').contentWindow.document.getElementById('btn1').onclick=function(){alert(123);return false;};
    </scipt>但是点击了按钮以后没反应啊?
      

  4.   

    window.onload=function(){
    document.getElementById('iframe1').contentWindow.document.getElementById('btn1').onclick=function(){alert(123);return false;};};
      

  5.   

    <script>
    function getIframe(id){
            return document.getElementById(id).contentWindow.document || document.getElementById(id).contentDocument;
        }

    getIframe('iframe').getElementById('btn1').onclick=function(){alert(123);return false;};
    </script>这样试试~·还有确保你的iframe标签上有ID为iframe还有子页面是否有ID为btn1的元素你也可以改成你自己的,但是ID必须写对~·
      

  6.   


    改了还是不行啊。。
    aa.html
    <input id="btn1" type="button" value="button" />bb.html
    <iframe id="iframe1" src="aa.html"></iframe>
    <script type="text/javascript">
    window.onload=function(){
    document.getElementById('iframe1').contentWindow.document.getElementById('btn1').onclick=function(){alert(123);return false;};
    };
    </scipt>
      

  7.   

    我这里IE FF都可以啊
    你的回标签</scipt> 写错了
      

  8.   


    哦,IE确实可以了我用的chrome,怎么处理啊?
      

  9.   


    悲剧了我ie可以。 chrome不行。。 晕。
      

  10.   


    chrome得上传到正式地址才行~·
      

  11.   

    chrome可能要用http://方式访问页面, 同域策略
      

  12.   


    可以了可以了  iis下可以成功。 确实要http方式访问。。 非常感谢。