Last active
August 28, 2017 02:28
-
-
Save masamitsu-konya/11162888 to your computer and use it in GitHub Desktop.
WebStorage API(LocalStorage)を使ってみた ref: http://qiita.com/masamitsu-konya/items/c69515604570150d3ab9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
localStorage.Hashikawa = "Artistic"; | |
localStorage["Hashikawa"] = "Artistic"; | |
localStorage.setItem("Hashikawa", "Artistic"); | |
//上記3行、どの書き方でも同じ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
localStorage.Hashikawa = "Artistic"; | |
localStorage["Hashikawa"] = "Artistic"; | |
localStorage.setItem("Hashikawa", "Artistic"); | |
//上記3行、どの書き方でも同じ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
・・・・・ | |
var val = localStorage.Hashikawa; | |
var val = localStorage["Hashikawa"]; | |
var val = localStorage.getItem("Hashikawa"); | |
// 上記3行、どの書き方でも同じ | |
document.querySelector("#result").innerHTML = val; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
・・・・・ | |
var val = localStorage.Hashikawa; | |
var val = localStorage["Hashikawa"]; | |
var val = localStrage.getItem("Hashikawa"); | |
// 上記3行、どの書き方でも同じ | |
document.querySelector("#result").innerHTML = val; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
・・・・・ | |
localStorage.removeItem("Hashikawa"); | |
var val = localStorage.Hashikawa; | |
・・・・・ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
・・・・・ | |
localStorage.removeItem("Hashikawa"); | |
var val = localStorage.Hashikawa; | |
・・・・・ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
localStorage.setItem("A", "Aだよ"); | |
localStorage.setItem("B", "Bだよ"); | |
localStorage.setItem("C", "Cだよ"); | |
localStorage.setItem("D", "Dだよ"); | |
localStorage.setItem("E", "Eだよ"); | |
var val = localStorage.getItem("A") + " " + | |
localStorage.getItem("B") + " " + | |
localStorage.getItem("C") + " " + | |
localStorage.getItem("D") + " " + | |
localStorage.getItem("E"); | |
document.querySelector("#result").innerHTML = val; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
localStorage.setItem("A", "Aだよ"); | |
localStorage.setItem("B", "Bだよ"); | |
localStorage.setItem("C", "Cだよ"); | |
localStorage.setItem("D", "Dだよ"); | |
localStorage.setItem("E", "Eだよ"); | |
var val = localStorage.getItem("A") + " " + | |
localStorage.getItem("B") + " " + | |
localStorage.getItem("C") + " " + | |
localStorage.getItem("D") + " " + | |
localStorage.getItem("E"); | |
document.querySelector("#result").innerHTML = val; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
・・・・・ | |
localStorage.setItem("E", "Eだよ"); | |
localStorage.removeItem("B"); | |
・・・・・ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
・・・・・ | |
localStorage.setItem("E", "Eだよ"); | |
localStorage.removeItem("B"); | |
・・・・・ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
・・・・・ | |
localStorage.setItem("E", "Eだよ"); | |
localStorage.clear(); | |
・・・・・ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
・・・・・ | |
localStorage.setItem("E", "Eだよ"); | |
localStorage.clear(); | |
・・・・・ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>WebStrage API</title> | |
<script type="text/javascript"> | |
function init() { | |
} | |
</script> | |
</head> | |
<body onload="init()"> | |
<div id="result"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment