views:

30

answers:

1

Hey, I have another incredibly simple JavaScript problem... I have a div that is shown when a link is clicked on. That is no problem and working fine. I then need the div to be hidden when the mouse is clicked anywhere on the page. Again, no problem in FF,Chrome,Safari and Opera but not in IE and it is really doing my head in now(!)

Here is the code

document.onmouseup = function()
{
  hide();
}

I have tried many variations on the theme, none of which so far work, even having the function just give an alert will not work at all in IE. And I am running out of ideas!

Any help would be appreciated immensly. Cheers.

A: 

I think the problem may be in your hide function..

If you haven't created the div with the id DropdownShare0 with some default display style, the code

"if (elm.style.display == "block")" will be false because if none is set when creating element it will return 'undefined'

So check that too..

kvijayhari
The script is only included if the element is on the page, and the element has a default display: none.This is then changed once the link has been clicked and some script has been fired to change the display to display:block.
rich