为什么 window.location 需要 3 -5 秒才能转到另一页?我想在确认后立即更改页面。
<script>
var a = confirm('Do you want to insert the device specifications now ؟');
if(a)
{
var name = '<?= $items_name ?>';
window.location = 'mobiles.php?name='+name;
}else
{
return false;
}
</script>
在我看来 location.assign 更快
<script>
var a = confirm('Do you want to insert the device specifications now?');
if(a) {
var name = '<?= $items_name ?>';
window.location.assign('mobiles.php?name='+name);
}
else {
return false;
}
</script>