Problem with iframe reading it

Is there a equivalent of jQuery live function inside prototype? I have a iframe which is dynamically loaded into dom, and I need to access elements inside iframe and I can't. I need to do something when certain element inside iframe is hovered, how can I do that with prototype or native js?


Assuming your iframeid is iframe_id and the link inside the iframe's id is iframe_link, heres a prototype script that will alert "hover" when the link inside the iframe is rolled over:

var $IFRAME = function (id){
    return $('iframe_id').contentWindow.document.getElementById(id);
function watch_iframe(){
    var x = $IFRAME('iframe_link_id');
    x.observe('mouseover', function(event) {
window.setTimeout(watch_iframe,1000);//makes sure iframe is loaded before intiating the watch_iframe function

credit where it's due: What is the way to access IFrame's element using Prototype $ method

Here is a DOM way, if your IFRAME is on the same domain:

In your parent page:

<iframe src="iframeContent.html"></iframe>
    function listen(elm){
        alert(elm.tagName + ' moused over');

In your iframe content:

<div onmouseover="top.listen(this)">
    mouse over me!

Need Your Help

How to make prepared statement using PDO in advanced queries?

php mysql pdo

I would like to ask for help with converting my mysql_* query to prepared statement using PDO technology. There are many of them which I cannot find on the internet how to solve them properly - mos...