是一个htm页面,在打开的时候,要跳转到新的连接,不能打开新的页面。
这样写有问题,怎么打开都是一个新页面呢?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>无标题页</title>
</head>
<body>
    <script language=javascript>
        function document.body.onload()
        {
            window.open("http://www.xxx.com/a.aspx");
         }
    </script>
</body>
</html>

解决方案 »

  1.   

     <script language="javascript">
        window.onload=function()
        {
            window.open( "http://www.xxx.com/a.aspx ");     }
        </script>
      

  2.   

    top.window.location.href= "http://www.xxx.com/a.aspx "; 
     
      

  3.   

    <html   xmlns= "http://www.w3.org/1999/xhtml "   > 
    <head> 
            <title> 无标题页 </title> 
      <script   language= "javascript "> 
            function openwindow()
            { 
                    window.open(   "http://www.xxx.com/a.aspx   ");           } 
            </script> 
    </head> 
    <body onload="openwindow()"> 
          </body> 
    </html> 
      

  4.   

    不行啊。我是ie7.window.open(   "http://www.xxx.com/a.aspx   ");   是打开新的网页,不能打开新的网页啊。
      

  5.   

     <script   language=javascript> 
                    function   document.body.onload() 
                    { 
                            window.open( "http://www.xxx.com/a.aspx "); 
                      } 
            </script> 改为
     <script   language=javascript> 
                    function   document.body.onload() 
                    { 
                            window.location.href="http://www.xxx.com/a.aspx "; 
                      } 
            </script> 说明:open是打开新页,location是对本页控制
      

  6.   

    我是ie7
    不管是open还是location都是打开新页面
    怎么解决?
      

  7.   

    在ie6中,就可以使用location在本页打开链接。
      

  8.   

    window.open('http://www.xxx.com/a.aspx','_self');