sessionStorage.someKey = 'someValue';
or if you prefer...
sessionStorage.setItem('someKey', 'someValue');
And to retrieve it.
sessionStorage.getItem('someKey')
or
sessionStorage.someKey
You can display the info with the Document Object Model like so...
document.getElementById("myvalue").innerHTML = sessionStorage.someKey;
You should get this in your HTML
<div id="myvalue">someValue</div>
No comments:
Post a Comment