Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1012 How can I trap a mouse button click anywhere in the document?

You are here: irt.org | FAQ | JavaScript | Pointer | Q1012 [ previous next ]

Try:

<SCRIPT LANGUAGE="JavaScript1.2"><!--
function myFunction() {
    alert('Hello World');
    return false;
}

document.onMouseDown = myFunction;
//--></SCRIPT>

Works over the document, links and buttons.

©2018 Martin Webb