我正在做一个应用程序,我相信html5网络存储,特别是localstorage,将对我有很大的帮助。令人惊讶的是,它并不像我想的那么容易。也许我并不真正理解整个概念,因为我对JavaScript不熟练。asp.net和html5网络存储
下面是我用来在外部.js文件中调用JavaScript函数的代码。
ScriptManager.RegisterStartupScript(this, this.GetType(), "StoreUserLogin", "StoreUserLogin('" + this.LoginHiddenField.Value + "');", true);
下面,上面的代码是JavaScript函数:
function StoreUserLogin(emailAddress) {
if (typeof (Storage) !== "undefined") {
//var emailAddress = document.getElementById('LoginHiddenField');
window.sessionStorage.emailname = emailAddress;
alert("Information from sessionStorage:- " + window.sessionStorage.emailname);
}
else
alert("Browser does not support storage");
}
那么,有什么问题吗? – hindmost 2015-03-03 10:13:09
问题是,它看起来不工作,我不知道什么是错的。我想让它工作。 – Bainn 2015-03-03 10:28:31