JavaScript Document (8) Events (8) ExtJS (9) Strings (3)
Exchange Links About this site Links to us 

|
General :: Web publishing :: JavaScript :: Events
Questions, answers and code examples dealing with javascript event handlers.
Articles:
This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Featured Article
Tracking clicks on banners and Google text adsQuestion: I want to track clicks on ads displayed on my site but the ads are in an IFRAME with the source hosted by the advertising company. How can I detect a click on a link in an IFRAME if the IFRAME source comes from a foreign domain?
Answer: It is supposed to be not possible (in a clean way) but here is a workaround:
Track the mouse cursor on the screen. When the window loses focus, check to see if the mouse's last position was near the IFRAME. It is not 100% accurate, but will detect most banner clicks.
Notes:
- The blue area around the IFRAME is the detection area.
- Clicking this area will sometimes count as a banner click, but since
nothing is there, not many people will click it. IE bug?
- Holding the mouse over the banner and alt-tabbing will also count as
a click. This isn't very likely either.
- Right-clicking the banner counts as a click, even if the link isn't
followed.
- If the user moves his mouse too fast, the cursor will not enter the
detection area (and not be detected).
- The form output is optional. It is only there so you can see what
is goin on.
- Replace the ####### with your iframe url.
- IFRAME only works in IE, so there is no netscape version of the script.
 | |  | | <html><head></head><body>
<br><br><br>
<table cellspacing=0 cellpadding=0><tr><td width=200></td><td
bgcolor=blue>
<iframe src="#######" width=300 height=50 scrolling=no vspace=15
hspace=15></iframe>
</td></tr></table>
<center>
<br><br><br><br><br><br><br><br><br><br>
<form name=f>
X<input name=x size=5><br>
Y<input name=y size=5><br>
In Iframe?<input name=i size=5><br>
Clicked Banner?<input name=cl size=5><br>
</form>
</center>
<script>
d=document;
function Point(x,y){
this.x=x;
this.y=y;
}
function Rect(x1,y1,x2,y2){
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.Contains=Contains;
function Contains(p){
with(this) return (x1<p.x && x2>p.x && y1<p.y && y2>p.y);
}
}
mouse = new Point(0,0);
iframe = new Rect (212,75,541,153);
function getMouseXY() {
mouse.x = event.clientX + d.body.scrollLeft;
mouse.y = event.clientY + d.body.scrollTop;
d.f.x.value = mouse.x;
d.f.y.value = mouse.y;
d.f.i.value = (iframe.Contains(mouse))?"Yes":"No";
}
function checkClick() {
d.f.cl.value = (iframe.Contains(mouse))?"Yes":"No";
}
function checkClick() {
d.f.cl.value = (iframe.Contains(mouse))?"Yes":"No";
}
function clearClick() {
d.f.cl.value = "No";
}
d.onmousemove = getMouseXY;
window.onblur = checkClick;
d.onclick = clearClick;
</script>
</body></html> | |  | |  |
|
| Most recent comments
2010-03-21 02:40:54:
by [hidden]
in Dating Scams
on Scammer Jane Mabou from Ivory Coast, Africa:
Hello dear ,
I am happy in your reply to my mail,
How was your day?.mine was cool over here in Dakar Senegal.
My dear like i told you in my first mail, My name is Monica Jammeh from Lib ... read more
|
2010-03-21 02:09:01:
by wanwan
in Dating Scams
on Dating scammer Tatyana (photos: Raven Riley):
@2010-03-17, 01:40:45 (updated: 2010-03-17, 01:48:37)
coltkitt from Foresthill, United States
|
2010-03-20 23:14:51:
by anonymous
in Dating Scams
on Is this Russian girl scamming me? How to recognize scammers:
Ref; Olga Malinkina posted earlier..THANK YOU to whomever posted the links....It is obvious that Olga was using Lera Pashkeeva photo's to try and scam me for money to come visit me in the USA with int ... read more
|
2010-03-20 23:08:34:
by Moon Queen
in Male Dating Scammers
on Dating scammer Romeo Siba Philips:
I know for sure he is a scammer. He took $40k from me and when I did not want to send him any more money he became arrogant, smug, nasty, and went on to another victim. He had claimed to be in Texas w ... read more
|
2010-03-20 22:54:22:
by anonymous
in Dating Scams
on Dating scammer Roselin Jemba jembarose@yahoo.com from Monrovia, Senegal:
que tal amigos, tambien resivi un mensaje similar o igual a los que estan publicados es una verdadera estafa y perdida de tiempo no crean en lo que les dicen estoy muy mortificado por lo que pasa en l ... read more
|
2010-03-20 22:48:40:
by anonymous
in Dating Scams
on Dating scammer Rose Sedu Mubarka:
It's a group of them lary hughes, Sam percy, Cole Johnson, Fidel Imoro, Yaya Kharim, Kojo Freeborn, Enejaro, they are not older than 21. They work for the adults who protect them, but they hardly get ... read more
|
|
2010-03-20 22:33:10:
by anonymous
in Dating Scams
on Dating scammer Sarah Sarpong:
dear men
hello,i spoke to sarah i did.she found a man already she did so leave her alone she has a new man in her life she does,she is has a new man she loves him very much.so get your mind off of ... read more
|
2010-03-20 21:07:39:
by DOC
in Dating Scams
on Dating scammer Olga:
Tanya (tanya.musician@gmail.com)
Teddy Bear.jpg
|
2010-03-20 20:45:00:
by Dirk
in Dating Scams
on Dating scammer Natalya from Osinniki, Russia:
[quote]Valeria
valeriamilka
KhersoUkraine[ /quote]
[r>[quote]If you’re thinking that I’m looking just for a man who could realize my needs, you’re wrong.[/quote]
|
2010-03-20 19:18:45:
by anonymous
in Dating Scams
on Dating scammer Alevtina:
i found the same mail of olga vatrushka , with the same storys as here so its 100% scam
|
|