Page 2 of 2

Posted: Mon May 29, 2006 12:53 pm
by Chris Corbyn
phppage wrote:Thanks for that, will give it a go and let you know :D
I'd stick it in a function that runs onload in the body. If you put it in the head just like that it won't work because "document" isn't finished loading.

It'll almost certainly need some fixing.

Posted: Mon May 29, 2006 1:08 pm
by phppage
It only seems to work in Netscape, not IE. Is captureEvent valid in IE do you know?

Posted: Mon May 29, 2006 1:12 pm
by Chris Corbyn
Oops sorry typo there - it's captureEvents().

Posted: Mon May 29, 2006 1:40 pm
by phppage
You are a star, got it to work with very little tweaking. Here is the final code

Code: Select all

<script language="Javascript" type="text/javascript">


function nullEvent()
{
    window.onunload = null;
}

function correctlinks() {
var links = document.getElementsByTagName('a');

for (var i in links)
{
    if (links[i].captureEvents) links[i].captureEvents(CLICK);

    links[i].onclick = nullEvent;
}
 }
</script>
</head><body onunload="window.opener.focus();" onload="correctlinks();" >
Thanks for your help.

Posted: Mon May 29, 2006 1:44 pm
by Chris Corbyn
Glad you got it working :)