Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I load a value using html5 local storage
    text
    copied!<p>I want to get my input also as an outup in an form table. I copied the code beneath because I only want to know how to get my output.</p> <p>I think that I have to change this </p> <pre><code>&lt;input type="button" value="load" onclick="load_local();"/ </code></pre> <p>so when I click on a button I get the value in a box like a form</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;TITLE&gt;HTML5 local storage tester (testbed)&lt;/TITLE&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="output_area" style="position:relative;width:100%;height:200px;overflow:auto; border: dotted 1px #ff0000;"&gt; &lt;/div&gt; &lt;div&gt; &lt;input id="local_storage_key" type="text" /&gt; &lt;input id="local_storage_value" type="text" /&gt; &lt;/div&gt; &lt;div&gt; &lt;input type="button" value="load" onclick="load_local();"/&gt; &lt;input type="button" value="store" onclick="store_local();"/&gt; &lt;/div&gt; &lt;script id="this_page_js" type="text/javascript"&gt; /* store some string data to local storage This is using some text input elements on the page for input.*/ function store_local(domid_prefix){ var keyinput = document.getElementById('local_storage_key').value; var valinput = document.getElementById('local_storage_value').value; try{ if(typeof(window.localStorage) != 'undefined'){ window.localStorage.setItem(keyinput,valinput); } else{ throw "window.localStorage, not defined"; } } catch(err){ output_str("store_local,error," + err); } } /* load some string data from local storage This is using some text input elements on the page for the key name input and value output.*/ function load_local(domid_prefix){ var keyinput = document.getElementById('local_storage_key').value; var valoutput = document.getElementById('local_storage_value'); try { if(typeof(window.localStorage) != 'undefined') { valoutput.value = window.localStorage.getItem(keyinput); } else { throw "window.localStorage, not defined"; } } catch(err) { output_str("store_local,error," + err); } } /* function to print to the debug area */ function output_str(str){ var da = document.getElementById("output_area"); da.innerHTML += str + "&lt;br/&gt;"; da.scrollTop = da.scrollHeight; } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>thanks for answering. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload