addEventListener to IFRAME
- From: "Quarco" <dont@xxxxxxxxx>
- Date: Sat, 28 Jun 2008 09:46:44 +0200
Next challenge.. :-)
How to execute a function on 'load' of (dynamically created) iframe..
E.g: alert the title of loaded document....
Tried this:
var frms =
document.getElementById('container').getElementsByTagName('iframe');
for(var i=0; i<frms.length; i++) {
frms[i].addEventListener("load", function() {
alert(frms[i].contentWindow.content.title);}, false);
}
This doesn't work.... :-(
Next 'solution' only alerts initial loaded page title:
var iFrames =
top.document.getElementById('container').getElementsByTagName('iframe');
for(var i=0; i<iFrames.length; i++) {
(function(monkey) {
iFrames[i].addEventListener('load', function(e) {
alert(this.src);
}, false);
})(iFrames);
}
Hope someone can help me out :-))))
Thanx in advance anyway..
Marco
.
- Prev by Date: Re: AJAX Question
- Next by Date: Re: Populate HTML Form from Text file...
- Previous by thread: Populate HTML Form from Text file...
- Next by thread: Variable initialization with curly braces
- Index(es):
Relevant Pages
|
Loading