0

window.locationを同じページに移動させる方法ですが、別の異なるdivタグを使用します(または次のようなdiv idを使用します:href = "#id")。

    if((mins == 0) && (secs == 0)) {
        window.alert("Time is up.Your score is "+score); // change timeout message as required
        window.location = "index.html" // redirects to specified page once timer ends and ok button is pressed
    } else {
        cd = setTimeout("redo()",1000);
    }

どんな助けでもいただければ幸いです。前もって感謝します。

4

2 に答える 2

2

.scrollIntoView()対象の要素で使用できます。

document.getElementById("the_div_id").scrollIntoView(true);
于 2013-01-19T04:58:10.267 に答える
-1

ハッシュを文字列として追加するだけです:

window.location + '#id';
于 2013-01-19T04:49:17.223 に答える