hi all, i was hoping somebody could help me out.
i'm trying to write a code that generates a random number between 1 and 9999 on page load, concatenates it with "pwn" at the start, and adds it to a disabled form text input box. this is the code i have below, but it's not working at all. any help would be greatly appreciated.
in the head section
my body tag
and the form field itself
thanks in advance.
i'm trying to write a code that generates a random number between 1 and 9999 on page load, concatenates it with "pwn" at the start, and adds it to a disabled form text input box. this is the code i have below, but it's not working at all. any help would be greatly appreciated.
in the head section
Code:
<script type="text/javascript"> function createcode() { var randomnumber = Math.floor(Math.random()*10000); var homecode = 'pwn' + randomnumber; } </script>
Code:
<body onload="createcode()">
Code:
<input type="text" name="homename" id="homename" disabled="disabled" /> <script type="text/javascript"> document.getElementByID("homename").value = homecode; document.write(homecode); </script>
Comment