I don't know whether this is a HTML or Javascript question, but i decided to put it here.
This is my problem:
I am making a simple HTML form that posts a random number (generated by Javascript) on my website, but I'm having trouble assigning the random number to the form.
This is what I have right now:
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <title>xxx</title>
- <script type="text/javascript">
- function changejweet()
- {
- document.reply.topic.value = "***RANDOM NUMBER***";
- document.reply.action = "http://site.com/post_reply/" +***RANDOM NUMBER***";
- }
- function randomnumber()
- {
- document.getElementById("rand").value = Math.round((1000000 - 500000) * Math.random() + 1);
- }
- </script>
- </head>
- <body onload=changejweet();>
- <form name="reply" action="site.com/post_reply/" method="post">
- <input type="hidden" name="topic" value="1">
- <input type="hidden" name="skipVerbose" value="TRUE">
- <input type="submit" name="submit" value="Click to send random number">
- </form>
- </body>
- </html>
I already tried:
Expand|Select|Wrap|Line Numbers
- document.reply.topic.value = rand;
- document.reply.action = "http://site.dom/post_reply/" + rand;
I am a javascript/HTML beginner and would like to know how to do this.
Can someone help me?
Thanks in advance !
MCV