You got me thinking and playing around with prototype. Elaborating on what arty said, it is not actually possible to extend element in frames because prototype makes reference to the window object when extending elements. It would take a big rewrite to let it accept an object and make reference to it instead of the window and document directly each time.
I played about and this might help some what.... (IE doesn't like the script) Element.addMethods('iframe', { document: function(element) { //this isn't the best? element = $(element); if (element.contentWindow) return element.contentWindow.document; else if (element.contentDocument) return element.contentDocument; else return null; }, $: function(element, frameElement) { //well neither is this really xD element = $(element); var frameDocument = element.document(); if (arguments.length > 2) { for (var i = 1, frameElements = [], length = arguments.length; i < length; i++) frameElements.push(element.$(arguments[i])); return frameElements; } if (Object.isString(frameElement)) frameElement = frameDocument.getElementById(frameElement); return frameElement || element; } }); Example.... var iframe = $('iframe'); var iframeElement = iframe.$('iframeElement'); Event.observe(iframeElement, 'mouseup', function(){ console.log('yup'); }); Event.observe($('iframe').$('iframeElement'), 'mouseup', function(){ console.log('yup2'); }); Or what you were looking for.... Event.observe($('iframe').document(), 'mouseup', function(){ console.log('yup3'); }); Note.... $('iframe').$('iframeElement').update('some text'); // -> error (no method) [Element.extend is cannot be called on the iframe element before it is returned] On Jun 24, 1:52 pm, AlannY <[EMAIL PROTECTED]> wrote: > Is it possible to observe events in iframe? > > var iframe = new Element('iframe'); > > iframe.observe('mouseup', function (e) { ... }); // Not works ;-( > > I found that in FF, I can > > iframe.contentWindow.document.addEventListener('mouseup', function (e) > {...}, true); // Works > > But, how to do it with Prototype? > tnx --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---