Calendar will not close

Hi there,

I read your examples about this topic but I’m still missing something, and its driving me crazy, my code is like this:



window.onload = function () {    

var mCal = new dhtmlxCalendarObject(‘calFechanac’);

// dhtmlxEvent(document.body,“click”,function(){ mCal.hide(); });

mCal.setPosition(24,-140);

mCal.setSkin(“simplegrey”);    

}

with the dhtmlx line commented calendar shows automatically when the input field get the focus but of course calendar wont close you click outside, if I uncomment the event line, the calendar doesnt show at all and I dont get any javascript errors…



What should be the correct sintax to close the calendar if i click outside ?

Could you attach a sample file ?



Any help will be appreciated!

Manuel







Can be done as

        mCal = new dhtmlxCalendarObject(‘calFechanac’);
        dhtmlxEvent(document.body,“click”,function(){
            mCal.hide();
        })
        dhtmlxEvent(document.getElementById(“calFechanac”),“click”,function(e){
            (e||event).cancelBubble=true;
        })