Web Storage API
HTML
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<header>
<h1>Web Storage API</h1>
</header>
<article>
<section>
<h2>Wish list</h2>
<textarea id="txtWishes" rows="5"></textarea>
<div id="actions">
<button id="btnSave" onclick=saveTargetImsi("test")>Save wish list</button>
<button id="btnDelete">Delete wish list</button>
</div>
</section>
</article>
</body>
</html>
CSS
body{
font-family: 'Segoe UI';
font-size:9pt;
}
header h1{
font-size: 14pt;
background-color: rgba(27,161,226,.7);
color:#fff;
padding:20px;
}
article{
width:80%;
margin:auto;
}
article section{
margin-top:15px;
}
article section h2{
font-size:12pt;
padding:5px;
}
article section textarea{
width:250px;
height:200px;
border:1px solid rgba(27,161,226,.7);
}
#actions button
{
padding:10px;
border-radius:5px;
background-color: rgb(27,161,226);
color:#fff;
}
JavaScript
function saveTargetImsi(target) {
if(typeof(Storage) != "undefined") {
if(sessionStorage.targets) {
sessionStorage.targets = sessionStorage.targets + ":" + target;
} else {
alert("New Storage");
sessionStorage.targets = target;
}
}
else
{
}
}
function getStorageTargetImsi() {
if(typeof(Storage) != "undefined") {
if(sessionStorage.targets) {
var sessionStringList = sessionStorage.targets.split(":")
for (var a in sessionStringList) {
targetsSeen.push(a)
}
} else { }
}
}