Understanding Ajax / Javascript

I hope someone can point out what is wrong with my thinking here.

I’m confused about some basics with Javascript. At the bottom of my HTML page, I have a script that calls an initialization function on window.onload. This function preps the page and calls another function for creating an XMLHttp object. Then I assign a function to an onchange even for a dropdown box that utilizes the XMLHttp object created in the previous function.

I cannot get this script to work. What I am confused about is how you pass objects and values to functions assigned to events, for example:

months.onchange = updateDays(‘myvalue’)

will not work as it executes the funciton immediately. How do I get this function to see the XMLHttp object without making it global?

Thanks in advance.