first.html
JavaScript:
// 'document.formName.textFieldName.value ' gives the value entered in the text field of the form
function send(){ localStorage["aadhaar"]= document.registration.naadhaar.value;}
html:
<form name="registration" method='get' id='1' action='second.html' onsubmit='send()'>
<input type='text' id='aadhaar' name='naadhaar' placeholder="Aadhaar number...">
<input type="submit" value='submit'>
</form>
second.html
javaScript:
function data(){ var aadhaar=localStorage.getItem("aadhaar"); document.getElementById('aadhaar').innerHTML=aadhaar;}
html:
<body onload="showDate(), data();">
Aadhaar number = <span id="aadhaar" ></span>
</body>
Remember: A javascript code is never executed unless it is inside a function which is triggered by an event like button click, selectiion, onload etc.
JavaScript:
// 'document.formName.textFieldName.value ' gives the value entered in the text field of the form
function send(){ localStorage["aadhaar"]= document.registration.naadhaar.value;}
html:
<form name="registration" method='get' id='1' action='second.html' onsubmit='send()'>
<input type='text' id='aadhaar' name='naadhaar' placeholder="Aadhaar number...">
<input type="submit" value='submit'>
</form>
second.html
javaScript:
function data(){ var aadhaar=localStorage.getItem("aadhaar"); document.getElementById('aadhaar').innerHTML=aadhaar;}
html:
<body onload="showDate(), data();">
Aadhaar number = <span id="aadhaar" ></span>
</body>
Remember: A javascript code is never executed unless it is inside a function which is triggered by an event like button click, selectiion, onload etc.
No comments:
Post a Comment