JQUERY from ONCLIK to IFRAME does not work

2

I make animated banners in Google Web Designer and use an IFRAME to call them on the page, I used a JQUERY code so when clicked on the IFRAME it opens another page but when I add 2 or 3 bannes, each one having its own site to open and functions with the different name, only one banner works, the others are without the ONCLICK function.

The code I used is this:

window.onload = function() {

    var oFrame = document.getElementById("FrameLateral");

    oFrame.contentWindow.document.onclick = function() {

    window.open('https://www.facebook.com/events/291519031247073/', '_blank');

    };

};

window.onload = function() {

    var oFrame = document.getElementById("myframe");

    oFrame.contentWindow.document.onclick = function() {

    window.open(' SITE ', '_blank');

    };

};

And in case this would be the IFRAME:

<center><iframe id="myframe" class="asd" src="http://127.0.0.1/CSS/animation/matanzafoz/index.html"frameborder="0" scrolling="no"></iframe></center><br>

and in another IFRAME:

    <center><iframe id="FrameLateral" class="asd" src="http://127.0.0.1/CSS/animation/novobanner/index.html"frameborder="0" scrolling="no"></iframe></center><br>
    
asked by anonymous 30.10.2016 / 03:59

0 answers