"Wendi" <wenditurner (AT) earthlink (DOT) net> wrote
Quote:
How can i capture an onClick event from within the calling iframe document
(not
using a cookie or something)? Any ideas?
Wendi Turner
wenditurner (AT) earthlink (DOT) net |
It still isn't totally clear what you're asking.
I assume you want an onclick event in the parent document to call a function
coded in the iframe's document (sample.htm), and you want the code that
instigates this action to be within the latter.
If so, say you created a link in the parent document (Iframe.htm) like:
<A HREF='#' id='callFrameFunc' >Whatever</A> (or any element with an onclick
event)
Then in sample.htm you would have:
<SCRIPT>
parent.document.getElementById('callFrameFunc').on click=fireClickFunctions;
</SCRIPT>
Alternatively you could simply use the element's onclick event to call a
function in the iframe (sample.htm)
<A HREF='#'
onclick="if(window.frames)window.frames[0].fireClickFunctions();return false">Do
it in the iframe</A>
If you wanted it the other way round (click in iframe calls function in parent),
the syntax in the parent document would be something like:
window.frames[0].document.getElementById('myElement').onclick=loca lFunction;
--
Stephen Chalmers