-3
當我點擊「保存」按鈕時,我想將HTML輸入值存儲在某處,因此當我重新加載頁面或重新加載瀏覽器時,它們將與我離開時相同。我不知道該怎麼做。如何存儲所有HTML輸入值
HTML代碼:
<p>
<input type="text" id="name1" class="input-class" disabled="true" value="Cigarette" />
<input type="number" id="input1" class="input-class" value="1" /> - Amount
<input type="number" id="input2" class="input-class" value="1" /> <input type="button" value="Sold" onClick="gamokleba()" />
<br>
<input type="text" id="name2" class="input-class" disabled="true" value="Winston" />
<input type="number" id="input11" class="input-class" value="1" /> - Amount
<input type="number" id="input21" class="input-class" value="1" /> <input type="button" value="Sold" onClick="gamokleba2()" />
</p>
<input type="button" value="Save All Value" onClick="..." />
JavaScript代碼:
function gamokleba (value) {
document.getElementById('input1').value = document.getElementById('input1').value - document.getElementById('input2').value;
}
function gamokleba2 (value) {
document.getElementById('input11').value = document.getElementById('input11').value - document.getElementById('input21').value;
}