<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>弹跳事件</title>
<script language="javascript">
function openwindow()
{
window.open("http://www.sina.com.cn","window","width=300,height=200,status=yes,menubar=yes,resizable=yes,scrollbars=yes,toolbar=yes");
}
</script>
</head><body onload=openwindow()>
 <a href="http://www.baidu.com">百度</a>
</body>
</html>我想做的是在打开链接“百度”后弹出一个“新浪”窗口。可我现在做的却是在打开窗口还没打开“百度”,“新浪”就先打开了,那位大侠帮帮忙。我想做到的最终目的是:现在很多网站,在打开一个网站时会同时弹出另一个窗口。用JS来实现。各位大侠帮帮忙。

解决方案 »

  1.   

    <a href="#" onclick="openwindow()">百度 </a>
    function openwindow() 

    document.location.href="http://www.baidu.com";
    window.open("http://www.sina.com.cn","window","width=300,height=200,status=yes,menubar=yes,resizable=yes,scrollbars=yes,toolbar=yes"); 
      

  2.   


    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
    <title>弹跳事件 </title> 
    </head>
    <body> 
    <a href="http://www.baidu.com">百度 </a> 
    </body>
    <script language="javascript">
    myWindow=window.open("http://www.sina.com.cn","window","width=300,height=200,status=yes,menubar=yes,resizable=yes,scrollbars=yes,toolbar=yes");
    myWindow.focus(); 
    </script>  
    </html>
      

  3.   

    想要的就是这个功能:谢谢指点~.~
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
    <title>弹跳事件 </title> 
    <script language="javascript"> 
    function openwindow() 

    document.location.href="http://www.baidu.com";
    window.open("http://www.sina.com.cn","window","width=300,height=200,status=yes,menubar=yes,resizable=yes,scrollbars=yes,toolbar=yes"); 

    </script> 
    </head> <body> 
    <a href="#" onclick="openwindow()">百度 </a> 
    </body> 
    </html> 
      

  4.   

    楼主的写法是正确的呀,一打开时就加载并弹出www.sina.com的窗口
      

  5.   

    <html> 
    <script type="text/javascript">
        open=window.open("http://www.sina.com.cn");
        open.focus(); 
    </script>  
    <body> 
    <a href="http://www.sina.com.cn">新浪 </a> 
    </body>
    </html>楼主,就是这样的!祝你学习快乐啊
      

  6.   

    你还没打开百度的是很,body体就已经加载sina了,代码是一句一句由上往下执行的。