0
私はlocalStorageに複数のデータを保存できましたが、すべてのデータをlocalStorageからフォームに呼びたいと思っています。下)(保存するローカルストレージにlocalstorageのすべてのデータをフォームに表示するにはどうすればよいですか?
機能を、それを保存するためのコードがある {
// Parse any JSON previously stored in allEntries
var existingEntries = JSON.parse(localStorage.getItem("allEntries"));
if(existingEntries == null) existingEntries = [];
var date = document.getElementById("date").value;
var brakes = document.getElementById("brakes").value;
var chain = document.getElementById("chain").value;
var seats = document.getElementById("seats").value;
var handlebars = document.getElementById("handlebars").value;
var entry =
{
"date": date,
"brakes": brakes,
"chain": chain,
"seats": seats,
"handlebars": handlebars
};
localStorage.setItem("entry", JSON.stringify(entry));
// Save allEntries back to local storage
existingEntries.push(entry);
localStorage.setItem("allEntries", JSON.stringify(existingEntries));
}
ん[この答え]で値を得ることができます(http://stackoverflow.com/questions/8419354/get-html5-localstorage-keys)help?一番上の投票回答は、キーに対応する値を取得する方法も示しています – Tung