Noob Javascript problem

BluuueJammm

Big Member
Apr 19, 2008
831
12
0
England
I'm not too familiar with javascript, could anyone tell me what I'm doing wrong here?

HTML:
<html>
<head>
<script type="text/javascript">
function changeLink()
{
document.getElementById('lat').innerHTML="test";
}
</script>
</head>
<body>

<p>
  <input type="button" onclick="changeLink()" value="Change link">
</p>
    <form id="form" method="post">
       <input name="lat" type="hidden" id="lat">
    </form>
</body>
</html>
Now what I want to happen is the value "test" to be passed to the hidden form like this:

HTML:
<form id="form" method="post">
       <input name="lat" id="lat" type="hidden" value="test">
</form>
However, what I actually get is this:

HTML:
<form id="form" method="post">
       <input name="lat" id="lat" type="hidden"><input>test
</form>
Any ideas as to what I'm doing wrong?

Thanks for any help.
 


Dude That Was Obvious. If You Want The Value 'Test' To Be Invisible, You Have To Make The Document You Are Getting Be Valued As 'Test'. Since U Were Using -----.inner.HTML="test". There Was Nothing Being Valued As "Test". Now When U made it -----.value="test". Now It Knew That Whatever Document You Were Getting Was Being Valued As The "test" parameters.