4 Replies - 1295 Views - Last Post: 11 May 2009 - 05:56 PM

#1 SixOfEleven  Icon User is offline

  • Planeswalker
  • member icon

Reputation: 1055
  • View blog
  • Posts: 6,643
  • Joined: 18-October 08

Changing an ad on page load?

Post icon  Posted 11 May 2009 - 05:23 PM

I have four static ads and I want one of them to display each time a page loads. I've never done Javascript before.

I'm not asking for the solution.

I was just wondering if it is possible. The ads are in <iframe> tags, from Amazon.com. Can you do this with Javascript? If not where should I look?
Is This A Good Question/Topic? 0
  • +

Replies To: Changing an ad on page load?

#2 crazyjugglerdrummer  Icon User is offline

  • GAME OVER. NERD WINS.
  • member icon

Reputation: 124
  • View blog
  • Posts: 690
  • Joined: 07-January 09

Re: Changing an ad on page load?

Posted 11 May 2009 - 05:32 PM

Its definitely possible, bordering on semi-easy. You can update the contents of an iframe just fine, as well as react to an onload event, just a matter of stuff them together :D . You want one of them to always display, and the others to change?

This post has been edited by crazyjugglerdrummer: 11 May 2009 - 05:34 PM

Was This Post Helpful? 1
  • +
  • -

#3 SixOfEleven  Icon User is offline

  • Planeswalker
  • member icon

Reputation: 1055
  • View blog
  • Posts: 6,643
  • Joined: 18-October 08

Re: Changing an ad on page load?

Posted 11 May 2009 - 05:41 PM

View Postcrazyjugglerdrummer, on 11 May, 2009 - 06:32 PM, said:

Its definitely possible, bordering on semi-easy. You can update the contents of an iframe just fine, as well as react to an onload event, just a matter of stuff them together :D . You want one of them to always display, and the others to change?


I just want one of the four to display on page load, doesn't matter which one. Since it IS possible I will look into Javascript. I like learning new things. Can you recommend a place to get started with Javascript?

Thx
Was This Post Helpful? 0
  • +
  • -

#4 crazyjugglerdrummer  Icon User is offline

  • GAME OVER. NERD WINS.
  • member icon

Reputation: 124
  • View blog
  • Posts: 690
  • Joined: 07-January 09

Re: Changing an ad on page load?

Posted 11 May 2009 - 05:51 PM

You would probably have an array with the four possible URL's of the ads, then change the src attribute of the iframe.

I can't offer you any good specific place for javascript, besides google results. :D If you know enough HTML already, just look for some beginning javascript tuts. You could look at the source of some webpages that have what you want, but I don't think that would be extremely fruitful in this case.
Was This Post Helpful? 0
  • +
  • -

#5 SixOfEleven  Icon User is offline

  • Planeswalker
  • member icon

Reputation: 1055
  • View blog
  • Posts: 6,643
  • Joined: 18-October 08

Re: Changing an ad on page load?

Posted 11 May 2009 - 05:56 PM

Thanks again.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1