2008-06-21, 11:45 PM
Hi guys,
I need a bit of help with some javascript. Basically i am learning it and am trying to make a small thing which has a text box and when you click the submit button it relaces a div with what you entered into the text box. I can get this to work but the problem is that it only appears for a second?
Any help would be great, Thanks.
Ps. Here's my code.
I need a bit of help with some javascript. Basically i am learning it and am trying to make a small thing which has a text box and when you click the submit button it relaces a div with what you entered into the text box. I can get this to work but the problem is that it only appears for a second?
Any help would be great, Thanks.
Ps. Here's my code.
<script type="text/javascript">
function updatediv(){
var content = document.input.name.value;
document.getElementById('divtoupdate').innerHTML = content;
}
</script>
<form name="input" onsubmit="updatediv();" method="post">
Enter your name:
<input type="text" name="name" size="30">
<input type="submit" value="Submit">
</form></p>
<div id="divtoupdate"></div>