次のようなコードを含む単純なWebフォームがあります。
//...
//tons of text
//...
<a name="message" />
//...
//tons of text
//...
<asp:Button ID="ButtonSend"
runat="server"
text="Send"
onclick="ButtonSend_Click" />
POSTの後、ユーザーをアンカー「メッセージ」に移動したいと思います。私はこれのために次のコードを持っています:
protected void ButtonSend_Click(object sender, EventArgs e)
{
this.ClientScript.RegisterStartupScript(this.GetType(),
"navigate",
"window.location.hash='#message';",
true);
}
この単純なJavaScriptはFirefox3.5.2では機能しません-URLはブラウザで変更されますが、ページはアンカーに移動されません。IE 8では、完全に機能します。
このJavaScriptコードがFirefoxで機能しないのはなぜですか?私は何かが足りないのですか?