Forums » General

Need Help with a Script.. DEVS?

Feb 25, 2012 Inevitable link
Well more like I need a script. Here's the Scenario. So I have many pages using a script to display an ad. I need a script where with one page , I can control what the script displays on all other pages. For instance:

Page 1
Page2 >Display a google ad
Page3

Well one day I decide Instead of an ad I want to provide a link to another site so I go to lets call it the

Masterpage > and here i change the link in the script

Now page 1,2, and 3 are display that link instead of the Google ad.

If anyone provide me with a script that does this that would be great. It shouldn't be too hard , But I know nothing about programming.

PS - My goal for this is to bring more traffic to Vendetta Online every once in a while in hopes to get more players playing.

Btw.. I get over 300k Page views a day
Feb 25, 2012 Phaserlight link
This type of thing should probably be emailed to the devs directly, unless you wanted us all to know what you have in mind. The next natural question is, what's the URL of your page?
Feb 25, 2012 Pizzasgood link
"A script" is pretty vague. You don't even say what language it should be in. Judging by the fact that you didn't even think to include that, I'd guess JavaScript, but it could be you were talking about PHP or Perl or even some bogus nonsense like ASP or ActiveX. Just something to keep in mind next time.

Here is an example. Stick it in a .js file and include it from each page you want it used in. It assumes that the ID of the element you want the code inserted into is "ad_container". If that is not the case, either update the element or update this code to reference the correct ID. Note that if any other code is already trying to set window.onload, you will have to manually adjust things so that they play nicely with eachother. To turn it off, just change the enable_link from true to false.

Here is the code:

/////////////////////////////////////////////////////////
// Replaces the content of the element whose ID
// matches the contents of the 'id' variable with
// whatever you put inside the 'link' variable.
// Set 'enable_link' to false to disable.
/////////////////////////////////////////////////////////
function set_link(){
var enable_link = true;

var link = "<a href='http://www.vendetta-online.com'>Vendetta Online: A twitch-based space MMO</a>";
var id = "ad_container";

if (enable_link){
var container = document.getElementById(id);
container.innerHTML = link;
}
}

// Set the code to run after the page has loaded.
window.onload = set_link;
/////////////////////////////////////////////////////////