假如想要在導向指定的網頁前,跳出訊息視窗的話,則使用以下方式的話,則訊息視窗會沒有跑出來,且導向指定的頁面

Response.Write("<script>alert('測驗時間到!')</script>")
Response.Redirect("result.aspx")

 

這時可以改用以下方式即可跳出訊息視窗,按下確定後轉向指定的網頁

Response.Write("<script language=javascript>alert('測驗時間到!')</script>")
Response.Write("<script language=javascript>window.location.href='result.aspx'</script>")

 

(2009/4/3 更新)

也可以使用以下語法,此語法來自 Allen 大大 在藍色小舖的回覆

Response.Write("<script>alert('測驗時間到!');location.href='result.aspx';</script>")
arrow
arrow
    全站熱搜

    alen1985 發表在 痞客邦 留言(0) 人氣()