I solved with this:

function doBind() {
  var frame;
  if ($.browser.msie) {
        frame = document.frames[0].document;
  } else {
        frame = document.getElementsByTagName("iframe")
[0].contentDocument.documentElement;
  }
  $(frame).bind('click', function(event) { alert('an element in frame
is clicked ' + event.target.innerHTML) })
}


Is there a "wrap" of jquery for above if/else? Or more generic
question, is there a "wrap" to get a iframe/frame in jquery?

I'm searching in jquery docs but I have not found anything again

On Aug 8, 10:32 am, julio <[EMAIL PROTECTED]> wrote:
> Ok thanks:) it works
>
> but I'm interested to "touch" less possible sample.html.
>
> And so I have tried this in main.html:
>
> function doBind() {
>   var frame=document.getElementsByTagName("iframe")
> [0].contentDocument.documentElement;
>   $(frame).bind('click', function(event) { alert('an element in frame
> is clicked ' + event.target.innerHTML) })
>
> }
>
> it would be a kind of "addEventListener" (using jquery-bind).
> On firefox 2.0.x it works but I suppose it's not good for explorer
> because is present 'contentDocument.documentElement'
>
> Have you any idea to make it "cross-browser"???
>
> Thanks,
> Julio

Reply via email to