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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.