Jump to content

very basic getElementById isssue


shaunmckinnon

Recommended Posts

not sure what the problem is.  everytime I run this script it tells me that the getElementById is undefined:

<html>
<head>
<title>test</title>
<script>
// JavaScript Document
//testing var
var displayTest;

//***256fX Calendar Widget***

//labels for the days of the week, names of the months, and number of days in each month
days = new Array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun");
months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
noDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

//fall back to today's date
today = new Date();

var x = months.length;
for(i=0; i<x; i++){
document.getElementById("testing").innerHTML="<br>"+months[i]+" - "+noDays[i]+"<br>";
}
</script>
</head>
<body>
<p id="testing"></p>
</body>
</html>

 

any help would be appreciated.  I'm quite new to Javascript, so it's probably something dumb.

 

thanks,

shaun

Link to comment
https://forums.phpfreaks.com/topic/112608-very-basic-getelementbyid-isssue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.