有人可以幫我重定向到JavaScript中的新頁面嗎?無法在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;
}
}
這裏了window.location = 'locations.php locationid =?' +共1頁;無法重定向此鏈接。
我不知道什麼是錯的,請指導我
感謝提前
你的$ redirect包含什麼?在重定向元素中添加http://或添加'http://'+'<?php echo $ redirect?> locations.php?locationid ='+ total1; – punit
$ redirect包含:http://app.ologie.us/app/admin/ –
將http://添加到您的鏈接並嘗試。你已經錯過了echo語句中的分號。 – punit