我有以下功能,重定向()不工作
Render: function (level, cpi, t1)
{
//...
if ((level.t0.value -= (t1 - this.t0)/1000) <= 0) {
alert("Game over!");
window.location.href = "levels.php";
}
//...
}
這是由
(function frame()
{
//...
Level.Render(level, cpi, Date.now());
//...
requestAnimationFrame(frame);
})();
如果第二個說法爲真,對話框顯示出來,如果叫了很多我點擊「確定」,它再次出現,再次,並且再次......沒有重定向,爲什麼?
'X - = Y <= Z',特別是如果你打算不寫曖昧代碼,讓別人保持這一點。 –
@MarcB是對的,x- = y <= Z --> x- = y不會給出數字 刪除等於... 如果在此之後不起作用,請使用php函數頭(「Location:url」)。 – angel