On Jan 20, 1:34 pm, Janko Grenivka <[email protected]> wrote: > On Tue, Jan 20, 2009 at 9:42 PM, Justin McConnell <[email protected]> wrote: > >var e = window.frames["myframe"].event; > > > assuming <iframe name="myframe"> somewhere in your HTML. > > Yes, that would bi fine if I had my own page. But on iGoogle page where I > would place my gadget, I don't have that luxury or do I?
If you don't know the name of the frame then you can access document.frames like an array with an index: document.frames[0]. But it sounds like you're loading the gadget from a webpage, in which case you are out of luck. Since the gadget will be rendered in an iframe from a different domain as the webpage, javascript won't be able to access the event object of the iframe. > > On Tue, Jan 20, 2009 at 9:42 PM, Justin McConnell <[email protected]> wrote: > > > On Jan 19, 10:15 am, JGrenivka <[email protected]> wrote: > > > Hi > > > > My question is really simple. In IE error handling I try to access > > > information about the source of the event. Yet srcElement comes up > > > undefined. In FF e.target works fine. How can I find out the source of > > > the event in IE within iFrame? > > > You will need to access the window object for the iframe that is the > > source of the event. Grabbing the event property might only work on > > iframes with your own pages though -- because of the same origin > > policy in browsers. > > > > I use standard javascript code, that works just fine on a normal HTML > > > page: > > > > function anError(e) > > > { > > > var el; > > > if (!e) > > > { > > > var e=window.event; > > > var e = window.frames["myframe"].event; > > > assuming <iframe name="myframe"> somewhere in your HTML. > > > > } > > > if (e.target) > > > { > > > el=e.target; > > > } > > > else if (e.srcElement) > > > { > > > el=e.srcElement; > > > } > > > alert(el.id); > > > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "iGoogle Developer Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Gadgets-API?hl=en -~----------~----~----~----~------~----~------~--~---
