Is there any difference between
document.onclick
and
window.onclick
event?
Thanks.
The JavaScript Window object is the highest level JavaScript object which corresponds to the web browser window.
The document object is the container for all HTML HEAD and BODY objects associated within the HTML tags of an HTML document. This could correspond to the top-most window, or an iframe within the window.
Update
After a quick test there really is no difference between the two. However, as others have said, window.onclick did not work when tested in IE8. So apparently the bottom line is that document.onclick
is the preferred choice.