sergiu reznicencu
sergiu reznicencu

Reputation: 1039

Replacing an ad's frame source

I have taken a subdomain from a site but when I'm using it with my site it shows me an ad under the page. I want to get ride of that ad. The page source where the ad's configuration is:

<frameset  rows="*,29" >
    <frame src="http://mysubdomaiin.org/Loggedpage.php" name="redir_frame" frameborder=0>

    <frame src="http://mysubdomaiin.org/KHgKKjl_popupgoogle.html" noresize="noresize" scrolling="no" name="ad_frame" 
frameborder="0">
    <noframes>
    Sorry, your browser does not support frames.  Click <a href="http://5.14.121.91:100/Loggedpage.php" TARGET=_top>here</A>
    </noframes>
</frameset>

I've tried to replace it with something using javascript:

  function replace(){
  document.getElementsByName('ad_frame').src = "http://www.google.com";
  }

but it doesn't work. What should i do?

Upvotes: 0

Views: 76

Answers (1)

Scimonster
Scimonster

Reputation: 33409

getElementsByName returns a NodeList, not a single element. You'll need to modify the first item of the list:

function replace(){
    document.getElementsByName('ad_frame')[0].src = "http://www.google.com";
}

Upvotes: 1

Related Questions