Click to See Complete Forum and Search --> : detecting click in the same window


pym59
09-23-2003, 12:40 PM
Is it possible to detect (capture ) click events in the same window. Example

I have a window with two frames:
1. a little frame at the top displaying anc counting the click in the window
2. a big one, the rest of the window, displaying webpages, which are not on the same server (for example www.altavista.com)

Is it possible to detect when the user click something in the frame containing the page www.altavista.com so that i can count the clicks in the upper frame.

I have no idea if it is possible and in which language this could be implemented

Thanks for an answer

AdamBrill
09-23-2003, 04:42 PM
If it would be possible, it would have to be done in JavaScript, but I don't believe that you can do that. Since the pages are off of your domain, you will get access denied errors when you try to set up an onclick event. If it could be done, it would have to be a hack to get around the security built into the browser...

pym59
09-25-2003, 05:47 AM
I have seen several examples, how to capture click event in a document, when i try to replace document with window, this dont work anymore

any ideas or is this exactly what it is not possible to do for security reasons
thanks


<SCRIPT LANGUAGE="JavaScript">
<!--
var flag = (window.Event)? true : false;
function documentHandler(e) {
if (flag) {
elem = e.target;
} else {
elem = window.event.srcElement;
}
alert('Element' + elem);
}
function clickHandler(e){
alert('Evenement transmis au niveau du bouton de formulaire.')
}
if (flag) {
document.captureEvents(Event.CLICK);
}
document.onclick = documentHandler;

// -->
</SCRIPT>