Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
12-17-2007, 09:34 PM #1
- Join Date
- Dec 2007
- Thanked 0 Times in 0 Posts
Retrieving the srcElement from an iFrame
When attaching a onkeydown event to an iFrame, is there some way to determine what element raised the event?
I can do this in a non iFramed page by using event.srcElement.type, but when using an iFrame, it comes back as 'undefined'.
Also event.srcElement.tagName, when using an iFrame, returns as 'body' instead of 'input'.
OR ... should I be able to attach the onkeydown in each page that is displayed in the iFrame?
Like I said above, it does work when not in an iFrame, but when I use the iFrame, the code no longer works on each page.
12-19-2007, 03:13 AM #2
- Join Date
- Oct 2003
- on a ship
- Thanked 6 Times in 5 Posts
ok here is what i think you are looking for:
main document source code:
<html> <head><title>your iframe</title></head> <body onclick="parent.getElm(event);"> <input type=button value=click><input type=text value='blahblahblah'><br> <table><tr><td height=100 width=100 bgcolor=red>click</td></tr></table> </body> </html>
Last edited by brandonH; 12-19-2007 at 03:33 AM.I make no attempt at pretending like I'm a professional. I offer help with what knowledge I do have.