2
我正在使用本地存儲器查看我的員工的活動日誌。他們從下拉框中選擇他們的活動,他們選擇的活動在Firefox中刷新後保留在下拉框中,但在谷歌瀏覽器中恢復默認設置。 Chrome中是否存在需要更改的設置才能保留選定的活動?這是我的一位員工的代碼。在Chrome中刷新後下拉值更改,但未在Firefox中更改
<script>
function foo1(a) {
//alert(a.value);
var d = new Date();
var c = document.getElementById("time1").innerHTML;
c = c + a.value + " was selected at: " + d.toString();
document.getElementById("time1").innerHTML = c + '<br/>';
localStorage.setItem(a.value, d.toString());
}
function load1() {
var c = "Wholesale Pictures.: " + localStorage.getItem("Wholesale Pictures.") +
'<br/>';
c += "NS Pictures.:" + localStorage.getItem("NS Pictures.") + '<br/>';
c += "NS ERO's.:" + localStorage.getItem("NS ERO's.") + '<br/>';
c += "BL ERO's.:" + localStorage.getItem("BL ERO's.") + '<br/>';
c += "Wholesale Staging.:" + localStorage.getItem("Wholesale Staging.") + '<br/>';
c += "Wholesale Scan.:" + localStorage.getItem("Wholesale Scan.") + '<br/>';
c += "Sirius Tags.:" + localStorage.getItem("Sirius Tags.") + '<br/>';
c += "Lunch Break.:" + localStorage.getItem("Lunch Break.") + '<br/>';
document.getElementById("log1").innerHTML = c;
}
</script>
<div class="david">
<h2><img src="Images/david.jpg" class="img-circle">  David</h2>
<p id="log1"></p>
<select id="options" class="form-control" onchange="foo1(this)">
<option>Select Work Area</option>
<option>NS Pictures.</option>
<option>NS ERO's.</option>
<option>BL ERO's.</option>
<option>Wholesale Staging.</option>
<option>Wholesale Scan.</option>
<option>Wholesale Pictures.</option>
<option>Sirius Tags.</option>
<option>Lunch Break.</option>
</select>
<div class="buttons">
<button id="log1" onclick="load1()">Activity Log</button>
</div>
<p id="time1"><br/></p>
</div>
作品完美的底部。謝謝! – 2014-12-06 21:09:01
很高興聽到它。如果您的問題已得到解決,請接受答案並/或提出上訴。 – chiliNUT 2014-12-06 21:28:50