我试图做一个刷新页面(并重置测验)并跳转到具有按钮的锚点的函数。Javascript名称跳转锚点
这适用于Chrome和Firefox,但在IE中它只是刷新到第一个命名锚点。
我的代码:
function resetQuiz(showConfirm)
{
if(showConfirm)
if(!confirm("Are you sure you want to reset your answers and start from the beginning?"))
return false;
window.location.reload(); //this works for chrome and firefox
window.location.hash="mercquiz"; //tried this for IE. doesnt work
}
IE版本....? – Hamish 2012-03-24 00:06:22
尝试为“if”块放置花括号。我知道在ANSI C中可能是一个模糊的情况 – puk 2012-03-24 00:18:44
IE版本是8.0 – Waiwhetu 2012-03-24 00:33:52