我想用javascript给下面frame中的id为RDBiframe的scr赋值,可是不成功,如果解决呢?
我在<body>下面,frame之后这样写,但不成功:
<script>
document.getElementById('RDBiframe').src='http://www.baidu.com';
</script>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<frameset rows="*" cols="0,*" framespacing="0" frameborder="no" border="0">
<FRAME src="" name="clicklog">
<frameset rows="142,*" frameborder="NO" border="0" framespacing="0">
<frame scr="" name="searchbar" scrolling="NO" noresize>
<frame id="RDBiframe" name="RDBiframe" SRC="">
</frameset>
</frameset>
<noframes>
<body>
</noframes>
</html>

解决方案 »

  1.   

    如果把它卸载document.onload里呢?
    或者JQuery的$(document).ready(function(){..})中
      

  2.   

    <script>
    window.onload=function(){
    document.getElementById('RDBiframe').src='http://www.baidu.com';
    }
    </script>
      

  3.   

    <html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        <script language="javascript" type="text/javascript">
            window.onload = function () {
                document.getElementById('RDBiframe').src = 'http://www.baidu.com';
            }
        </script>
    </head>
    <frameset rows="*" cols="0,*" framespacing="0" frameborder="no" border="0">
        <frame src="" name="clicklog" />
        <frameset rows="142,*" frameborder="NO" border="0" framespacing="0">
            <frame src="" name="searchbar" scrolling="NO" noresize />
            <frame id="RDBiframe" name="RDBiframe" src="" />
        </frameset>
    </frameset>
    <body>
        <noframes>
        </noframes>
    </body>
    </html>
      

  4.   

    document.getElementById('RDBiframe').src = 'http://www.baidu.com';
      

  5.   

    document.getElementById('RDBiframe').src = '';
      

  6.   

    这样是不行的 document.getElementById('RDBiframe').src = 'url';加个nama属性 
     <frame id="RDBiframe" name="RDBiframe" src="" />RDBiframe.document.location = "url"
    或者不用document  楼主可以试试