Article View: it.comp.lang.javascript
Article #1I would like to intercept all click events on my document.
From: zoltix
Date: Thu, 20 Jan 2005 16:37
Date: Thu, 20 Jan 2005 16:37
27 lines
2093 bytes
2093 bytes
Hi,
I am beginner in JavaScript. I would like to intercept all click
events on my document. I use this function for that
document.onmousedown=click;. It works well. But I would like to
continue the execution code on a other button or anything else.
Example
1) Click anywhere intercept click->Execute the code in function click().
2) Click on a link�. intercept click -> Execute the code in function
click() ->Load the link(http://test.html)
3) Click on a button� intercept click-> Execute the code in function
click() ->Execute the code for the button(submit, or other javascript)
Thank a lot for your help�
function click() {
if (event.button==1) {
alert(�Test event�)
//execute before�.ex close all div
}
//Here continue code
}
Technical Details
Message-ID:
<41efde45$0$2560$ba620e4c@news.skynet.be>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!newspeer.monmouth.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.multikabel.nl!skynet.be!newspost001!tjb!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 113fd6,6ccb09e9f081730f,start X-Google-Thread: fb3cb,6ccb09e9f081730f,start X-Google-Thread: 1008fe,6ccb09e9f081730f,start X-Google-Thread: 100e17,6ccb09e9f081730f,start X-Google-Attributes: gid113fd6,gidfb3cb,gid1008fe,gid100e17,public X-Google-Language: ENGLISH,CP1252 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!newspeer.monmouth.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.multikabel.nl!skynet.be!newspost001!tjb!not-for-mail Date: Thu, 20 Jan 2005 17:37:22 +0100 From: zoltix <newsgroups@lli.be> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041217 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: it.comp.lang.javascript,comp.lang.javascript,fr.comp.lang.javascript,alive.internet.lang.javascript,comp.lang.java.javascript,mygale.javascript Subject: I would like to intercept all click events on my document. Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Lines: 27 Message-ID: <41efde45$0$2560$ba620e4c@news.skynet.be> Organization: -= Belgacom Usenet Service =- NNTP-Posting-Host: c8651a7f.news.skynet.be X-Trace: 1106239045 news.skynet.be 2560 217.136.15.157:38055 X-Complaints-To: usenet-abuse@skynet.be