Giddy Rob Posted May 11, 2010 Share Posted May 11, 2010 Hey, can someone please tell me why the code below will not add a value to a hidden field, but it will output to screen: <SCRIPT LANGUAGE="Javascript"> <!-- // Array of day names var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"); // Array of month Names var monthNames = new Array( "January","February","March","April","May","June","July", "August","September","October","November","December"); var now = new Date(); var super = (dayNames[now.getDay()] + ", " + monthNames[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear()); // --> </script> <body><script>document.write(dayNames[now.getDay()] + ", " + monthNames[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear()); document.getElementByID("newsdates").value = (super);</script> <input type="hidden" name="newsdates" id="newsdates" value="" /> </body> </html> When I load the page it should add the date to the value by id, but I cant get it to work. Thanks in advance Cheers Rob Quote Link to comment Share on other sites More sharing options...
tomfmason Posted May 12, 2010 Share Posted May 12, 2010 it is getElementById not getElementByID Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.