Automatically click on an item within Iframe using javascript or Jquery

Discussion in 'HTML & Website Design' started by Lashan, Jun 29, 2012.

  1. #1
    Hi guys,

    I have two web pages on separate domains.

    First one is
    www.mycrictime.com/test/one.html
    It contains a picture covered by an advertisement. When you click close button or advertisement it closes.

    The second page use an iframe to get first page.
    www.auto-ads.info/test/two.html

    What I want is to click automatically on that close button when the second page (two.html) loads. So when you load two.html the advertisement will automatically closed.
    I mean when someone loads two.html, the advertisement should closed automatically within the iframe.
    I have done some part but didn't work. Here's what I did.

    In two.html page

    <script type="text/javascript">
    function removeAd() {
    window.frames[0].document.getElementById('layer1').click();

    }
    </script>

    [FONT=&amp]And load " removeAd " function on page load.
    Someone please help me to fix this issue.[/FONT] The above Javascript is not working. Your kind help is highly appreciated.
     
    Lashan, Jun 29, 2012 IP