javascript - Issue with recalling information -


i new @ java script , trying practice have learnt.

i tried create text field access , recall information.

<body>  <form>   name of book have read: <input id="books" type="text" name="ewq" value="qwe">   <input  type="submit" name="ui" value="submit" onclick="bookse()"> </form>  <p id="qwe">name:</p>  <script type="text/javascript"> function bookse() {   var nameofbook = document.getelementbyid('books').value;   document.getelementsbyid('qwe').innerhtml = nameofbook; } </script> </body> 

and tried local storage

<form id="book">   name of book have read: <input id="books" type="text" name="" value=""> </form>  <p>name:</p>  <script type="text/javascript"> var x = document.getelementbyid('books'); if (localstorage.books) {   localstorage.books = x;   document.getelementsbytagname('p').innerhtml = x; } </script> 

and none of them worked. mistakes

document.getelementsbyid('qwe').innerhtml = nameofbook; 

there no function document.getelementsbyid(), should getelementbyid:

document.getelementbyid('qwe').innerhtml = nameofbook; 

the example using local storage seems rather pointless me, never read storage contents, aside other issues.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -