不能在javascript中重定向新页面

can't redirect new page in javascript?

本文关键字:重定向 新页面 javascript 不能      更新时间:2023-09-26

有人能帮我重定向到javascript的新页面吗?

这是我的代码

<p style=float:right;><font color="green"><a href=""  onclick='return validate1();'>Delete</a></font></p>

function validate1()
{

var j1=0;
     for(var i=0; i <document.Check.clickeduser.length;i++)
        {
            if(document.Check.clickeduser[i].checked)
                {
                    if(j1==0)
                    {   
                        total1 +=document.Check.clickeduser[i].value;
                    }
                    else
                    {
                        total1 +="|"+document.Check.clickeduser[i].value;
                    }
                j1++;
                }
        }
if(total1=="")
{

alert("Select user to Delete"); 
return false;
}
else
{

var where_to= confirm("Do you really want to delete??");
 if(where_to==true)
 {
 window.location = '<?php echo $redirect ?>locations.php?locationid='+total1;

 }
 else
 {
 total1="";

     document.Check.checkall.checked = false;
//alert("alert");
 for(var j=0; j<=document.Check.clickeduser.length;j++)
    {
     document.Check.clickeduser[j].checked = false;
    }

 }
return true;
}

}

窗口。locationid='+total1;无法重定向此链接。

我不知道怎么回事,请给我指路

Thanks for advance

代替

window.location = '<?php echo $redirect ?>locations.php?locationid='+total1;

试试这个

window.location = 'locations.php?locationid='+total1;  // why you need $redirect;

你可以试试这个

//There was no ';' in <?php echo ?>
window.location = '<?php echo $redirect; ?>locations.php?locationid='+total1;