[thelist] JavaScript: Why can't this function see...

Tom Dell'Aringa pixelmech at yahoo.com
Thu Mar 10 08:55:56 CST 2005


Hi all,

Still tweaking my date picker. It's working fine, but there is one thing that is really bugging
me. In the beginning of the script, I set a couple global variables:

var currentDateInput, calDiv;

Then in my CalInit() script, I set calDiv:

calDiv = document.getElementById("calendar");

Thereby assuring that all my function can use it so I don't have to reference it each time. This
works except for in one case, my ShowCalendar() function. This one line in that function:

	calDiv.style.display = "block";

will error out - "calDiv has no properties" unless I re-declare the calDiv variable in that
function. I cannot seem to figure out why it seems to be out of scope or doesn't see the
reference. 

You can see the page at:

http://www.pixelmech.com/rev/calendar-widget_v2.html

The JS is in the head. Any input is appreciated.

Tom


http://www.pixelmech.com/

Melissa: Ace, Where are you?
Ace Ventura: I'm in Psychoville and Finkle's the Mayor.



More information about the thelist mailing list