novartic Posted June 8, 2009 Share Posted June 8, 2009 Hia chaps.Looked into this a few months back with my own site though with no luck.Did a search today as I need to get it working >.<What I am after is the following:Load the home page or what ever, and your add shows, along with a hyperlink for the user to do a clicky.If the user then refreshes the page or goe's to another page, the add will automatic show another add in the same location along with a link etc..I found this which was very interesting, though I cant get it working with my gifs or for that matter get it working at all inc the hyperlinks. <script type="text/javascript">//<![CDATA[var theImages = [{ url: "images/Companys/Maxpower_Nissan.gif" // <jsp:forward page="http://www.google.com" />},{ url: "images/Companys/banner_120x600.gif"},];var randomNumber;var previouslyUsedRandomNumbers = "";for(var i = 1; i <= 1; i++){ do { randomNumber = Math.floor(Math.random() * theImages.length); } while(previouslyUsedRandomNumbers.indexOf("|" + randomNumber + "|") >= 0); previouslyUsedRandomNumbers += "|" + randomNumber + "|"; document.getElementById("i" + i).src= theImages[randomNumber].url; }//]]></script> Please advice Link to comment Share on other sites More sharing options...
makeitspiffeh Posted June 8, 2009 Share Posted June 8, 2009 I did this before once and I used a php random insert script.... I don't recall exactly what the code was, but try looking into that. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 8, 2009 Share Posted June 8, 2009 In this code: var theImages = [{ url: "images/Companys/Maxpower_Nissan.gif" // <jsp:forward page="http://www.google.com" />},{ url: "images/Companys/banner_120x600.gif"},]; There's an extra comma at the end that is going to cause a problem.This line is completely pointless:for(var i = 1; i <= 1; i++)I assume that originally there was more than one ad placeholder. Link to comment Share on other sites More sharing options...
novartic Posted June 8, 2009 Author Share Posted June 8, 2009 Its all done now in PHP. It works perfectly as an include too. :)Check it out.http://www.risingsunuk.comPS, how do you stop spam bots from posting porn on your forum? Let along stopping them from registering? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 8, 2009 Share Posted June 8, 2009 I prefer to use hidden inputs and random names instead of a captcha. You can have a form like this: <input type="text" name="subject" style="display: none;"><input type="text" name="comments" style="display: none;"><input type="text" name="message" style="display: none;">Subject: <input type="text" name="dj38s2j9"><br>Message: <input type="text" name="k39d84j5"><br><input type="submit"> Once that gets submitted, you check if the "subject", "comments", or "message" fields were filled out. If they were filled out, then it's probably a spam bot. Otherwise, you use the other two random name fields for your data. Link to comment Share on other sites More sharing options...
novartic Posted June 29, 2009 Author Share Posted June 29, 2009 I know what I did wrong >.< what a numpty... sorry to bother you on that last question. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.