我想循环打开很多个页面,我写了代码,可是总是只打开一个页面。请大家帮我看看。
    <script language="javascript">
           
function  delet()
{

            var j=0;
var f = document.all("form1");
var strWin="";
for (i=0;i<f.elements.length;i++)
{
if (f.elements[i].name.indexOf("chk_Show") != -1)
{
if (f.elements[i].checked == true)
{
var url ="person_search_results.aspx?postid=" + f.elements[i+1].value + "&company_id="+f.elements[i+2].value ;
strWin = "newbrown"+i;
window.open(url,strWin);
       
           
}

}
}
}           
</script>

解决方案 »

  1.   

    alert(f)看下f 的值是什么。。
      

  2.   

    检查f.elements.length 。
    只能一个一个的if 看下 。
      

  3.   

    window.open ('page.html','newwindow1'); window.open ('page2.html','newwindow2'); 
    这样也只能打开一个页面,奇怪,为什么不能同时打开呢?帮帮我。
      

  4.   

    function delet()
     {
     var strWin="";
     for (i=0;i<5;i++)
     {  
    var url ="bbb.html?postid=" ;
    strWin = "newbrown"+i;
    window.open(url,strWin); 
     }
     }
    delet();这样是可以的,调试跟踪一下if条件吧
      

  5.   

    <html>
    <head>
    <title></title>
    <script type="text/javascript">
    function select()
    {
    window.open ('22.html','newwindow1','_blank');  
             window.open ('33.html','newwindow2','_blank');  
    }</script>
    </head>
    <body onload=select()>
    </body>
    </html>
    -------------------------
    在window.open(url,strWin)里再加一个参数“_blank”。这样就是新打开一个浏览器的意思,你原来的是在同一个浏览器里打开那么多地址,都被你打开过了 ,但是后来的覆盖了前面的。
      

  6.   

    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    <head>
    <title> new document </title>
    </head> <body>
    <script language="javascript">
    <!--
    window.open('http://www.baidu.com');
    window.open('http://www.baidu.com');
    //-->
    </script>
    </body>
    </html>
      

  7.   

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head><body>
    <script type="text/javascript">
    var arr=new Array();
    arr[0]="http://sohu.com"
    arr[1]="http://yahoo.com.cn"
    arr[2]="http://google.com.cn"
    for(i=0;i<arr.length;i++)
    {
       window.open(arr[i]);}</script>
    </body>
    </html>
      

  8.   

    有啥好奇怪的..我要是浏览器作者也不会让你一次打开那么多个页面..事实上在IE的严格模式下,除非用户有点击页面,否则纯用JS ,你一个页面都打不开