Click to See Complete Forum and Search --> : click mouse anywhere and load a predetermined page


inta
06-20-2003, 01:18 AM
I would like a script that is enabled on load to trap a mouse click no matter where it is clicked on the page. When the mouse is clicked, I would like to load a predetermined url.

The page I wish to use this script on will not have many elements on it so I do not want to use href. I would much prefer to simply click the mouse and the next page will load.

I can do this with a key press but I cannot work out how to do it with a mouse click.

Any assistance is greatly appreciated.

Khalid Ali
06-20-2003, 02:09 AM
to capture a click event on a document you'd need the following code

function ProcessClick(){
//in here you can point to any url
window.location.href = url;
}

if(!document.all){//for NS
document.captureEvents(Event.CLICK);
}
document.onclick=ProcessClick;

Charles
06-20-2003, 05:21 AM
<body onclick="top.location = 'http://www.w3.org/'">