I am hooking into a frame event, this is what I am doing:
1) after main frame loaded, use setTimeout technique to observe child frame
head element ready
2) inject prototype code into header
3) register click event for this frame
NOTE BELOW: I need help with the bindAsEventListener statement, it isn't
working.
var timer = null;
function PageLoaded() {
var framedoc = window.frames[0].document;
console.log(framedoc);
timer = setTimeout(function () { headHandler(framedoc); }, 1000);
}
function headHandler(framedoc) {
console.log('headHandler');
var head = framedoc.getElementsByTagName('head');
if (head.length == 0)
timer = setTimeout(function () { headHandler(framedoc); }, 1000);
else {
clearInterval(timer);
console.log(head);
var script = new Element('script', {'type':'text/javascript',
'src':'/Library.Jscript/prototype-1.6.1.js'});
head[0].appendChild(script);
framedoc.observe('click', function () { alert('ding'); });
//framedoc.observe('click', handleClick.bindAsEventListener(framedoc));
}
}
function handleClick(e) {
alert(e.element().identify());
}
document.observe('dom:loaded', PageLoaded());
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.