我正在做一個應用程序,我相信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