我有这些js函数:
var count = 0;
function offlineSubmit() {
var field1, field2, field3, field4, field5;
field1 = document.getElementById("fnTxtBox").value;
field2 = document.getElementById("lnTxtBox").value;
field3 = document.getElementById("mailTxtBox").value;
field4 = document.getElementById("phoneTxtBox").value;
field5 = document.getElementById("companyTxtBox").value;
var allFieldsString = field1 + "," + field2 + "," + field3 + "," + field4 + "," + field5;
offlineStore(allFieldsString);}
function offlineStore(allFieldsString) {
if (Modernizr.localStorage) {
localStorage.setItem(count.toString(), allFieldsString);
count++;
}}
其中一个主要问题实际上是让更改的js代码运行,我的项目继续运行以前的版本,但它最终更新了,这是我提交表单时当前运行的代码。我不明白为什么localStorage不受影响,或者我根本无法访问同一个。