Help - Search - Members - Calendar
Full Version: Store data locally in HTML
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
AnSin
Hi !

I have a requirement in which any user can write a simple text field and submit.After submission I want the data to be stored on the same page and when another user enters new text, it should get appended to the original text. The website that I am working for is just made of html pages stored on a server.
I tried doing something like below but the data gets lost on refresh.I am new to the world of html.Any help would be highly appreciated.

<html>
<head>
</head>
<body>
<script type="text/javascript">
function storeThis(){
var formInput = document.getElementById('someText').value;
document.getElementById('newText').innerHTML = formInput;
}
</script>
<p>My Text<span id='newText'></span> </p>

<input type='text' id='someText' value='Write here' />
<input type='button' onclick='storeThis()' value='See what you wrote'/>
</body>
</html>

Thanks!
pandy
Can't be done with HTML and it can't be done with JavaScript. You need a server side script for this.
Christian J
I'd add that "local storage" is the name of a kind of super cookie.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.