Click to See Complete Forum and Search --> : Clicking within a frame


nca
01-21-2006, 01:53 PM
Would it be possible to have javascript detect if anything is clicked within a frame in a 2 frame window?

Such as this example:

Have a window open that is divided into 2 frames, a top and bottom. Would it be possible for the top frame to contain a script to know if anything has been clicked within the bottom frame's contents?

or I could have have a page open a new window and report back to the first page if anything has been clicked within the new window?

I am running a page exchange and would like to implement the feature of knowing if a member actually clicks on any links within the page that is being displayed.

Any thoughts are GREATLY appreciated. :)


Here is my example frame window:


<html>

<head><title>Site</title></head>

<frameset rows="45,*" framespacing="0" border="0" frameborder="0">

<frame name="top" scrolling="no" noresize src="topframe.php">

<frame name="bottom" noresize SCROLLING="yes" src="http://www.SiteThatIWantToKnowIfClickedOn.com">

<noframes>
<body><p>This page uses frames and your browser does not support them.</p></body>
</noframes>

</frameset>

</html>

bpat1434
01-21-2006, 11:36 PM
Possibly worth reading...
JavaScript - Introduction to Frames (http://www.quirksmode.org/js/frameintro.html)

And also:
How can I capture keypress events of frames to process them in the frameset ? (http://www.faqts.com/knowledge_base/view.phtml/aid/2254)

JPnyc
01-21-2006, 11:42 PM
But it's so much easier to put it in the 2nd frame doc. Just set a flag and put it onclick of the body tag

bpat1434
01-21-2006, 11:51 PM
But if it's a remote file, it won't work by editing the page....

madwormer2
01-22-2006, 08:33 AM
If it's a remote file you can't access it via javascript full stop.

Security reasons.

JPnyc
01-22-2006, 03:56 PM
You could use an iframe, put onclick="flag='true';" in the tag, then test for the value of 'flag'. Of course be sure you initialize flag=false; and that it's a global variable