The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

javascript help plz

4 posters

Go down

Solved javascript help plz

Post by Rougewraith July 11th 2009, 6:13 am

can anyone tell me why this code wont work in my links widgit? but will work in a notepad file. if it can be fixed to work plz tell me how it can be optimized i got it off a code generator called HTML BASIX. its supposed to be a img/link rotator

heres the code

Code:
<script type="text/javascript">
<!-- Begin
rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
};

function rand(number) {
   var result = Math.ceil(rnd()*number);
   if (!result)result++;
        return result
};
var ad_cnt1 = 6;
var ad1 = rand(ad_cnt1);
var link1;
var adBanner1;
var width1
var height1
if (ad1==1) {
link1="http://techzone.forumpro.eu";
adBanner1="http://i701.photobucket.com/albums/ww19/techzo

ne_bucket/mini-banner.gif";
width1="120";
height1="80";
alt1="Techzone";
}
if (ad1==2) {
link1="http://www.archonrpg.com/";
adBanner1="http://www.archonrpg.com/media/waffleed.ico";
width1="120";
height1="80";
alt1="Waffle";
}
if (ad1==3) {
link1="http://www.petitionspot.com/petitions/SaveSGA/";
adBanner1="http://i652.photobucket.com/albums/uu241/rouge

wraith/SGA-1.jpg";
width1="120";
height1="80";
alt1="SaveSGA";
}
if (ad1==4) {
link1="http://www.forumotion.com/";
adBanner1="http://www.illiweb.com/fa/banner/en/banner5.pn

g";
width1="120";
height1="80";
alt1="free forum";
}
if (ad1==5) {
link1="http://yoursmiles.org/";
adBanner1="http://yoursmiles.org/img/sbutton.gif";
width1="120";
height1="80";
alt1="Free smilies";
}
if (ad1==6) {
link1="http://www.newgrounds.com/refer/rougewraith";
adBanner1="http://img.ngfiles.com/fan-net/Noob-

Antichrist2.gif";
width1="120";
height1="80";
alt1="Newgrounds";
}
document.write('<center><a href="' + link1 + '"

target="_top">');
document.write('<img src="' + adBanner1 + '" width=' +

width1 + ' height=' + height1 + ' border=0 alt="' + alt1

+ '"></a>');
document.write('</center>');
// End -->
</SCRIPT>


Last edited by Rougewraith on July 12th 2009, 4:47 am; edited 1 time in total
Rougewraith
Rougewraith
Forumember

Posts : 99
Reputation : 0
Language : English
Location : Arkansas/Washington

http://godlingswrath.4umer.com

Back to top Go down

Solved Re: javascript help plz

Post by sworddude247 July 11th 2009, 6:27 am

I'm not sure...
avatar
sworddude247
Forumember

Posts : 197
Reputation : 0
Language : Copy & paste this to your language box!

http://dannysforum.4umer.net

Back to top Go down

Solved Re: javascript help plz

Post by Rougewraith July 11th 2009, 7:02 am

is there anyone who can help me? i want to show all of these links its just i have alot and i dnt want to have them all there at once
Rougewraith
Rougewraith
Forumember

Posts : 99
Reputation : 0
Language : English
Location : Arkansas/Washington

http://godlingswrath.4umer.com

Back to top Go down

Solved Re: javascript help plz

Post by RoNo July 12th 2009, 4:28 am

This version of your affiliates-banner-rotator will work. Pause is set to 5 seconds: ("cycle1()",5000)
Code:
<script type="text/javascript">
var imgs1 = new Array("http://i701.photobucket.com/albums/ww19/techzone_bucket/mini-banner.gif","http://www.archonrpg.com/media/waffleed.ico","http://i652.photobucket.com/albums/uu241/rougewraith/SGA-1.jpg","http://www.illiweb.com/fa/banner/en/banner5.png","http://yoursmiles.org/img/sbutton.gif","http://img.ngfiles.com/fan-net/Noob-Antichrist2.gif");
var lnks1 = new Array("http://techzone.forumpro.eu","http://www.archonrpg.com/","http://www.petitionspot.com/petitions/SaveSGA/","http://www.forumotion.com/","http://yoursmiles.org/","http://www.newgrounds.com/refer/rougewraith");
var alt1 = new Array("Techzone","Waffle","SaveSGA","Free Forum","Free smilies","Newgrounds");
var currentAd1 = 0;
var imgCt1 = 6;
function cycle1() {
  if (currentAd1 == imgCt1) {
    currentAd1 = 0;
  }
var banner1 = document.getElementById('adBanner1');
var link1 = document.getElementById('adLink1');
  banner1.src=imgs1[currentAd1]
  banner1.alt=alt1[currentAd1]
  document.getElementById('adLink1').href=lnks1[currentAd1]
  currentAd1++;
}
  window.setInterval("cycle1()",5000);
</script>
<a href=""http://techzone.forumpro.eu"" id="adLink1" target="_blank">
<img src="http://i701.photobucket.com/albums/ww19/techzone_bucket/mini-banner.gif" id="adBanner1" border="0" width="120" height="80"></a>



Since there are only 6... All at once (in a row) looks OK
javascript help plz Rowlinks
Code:
<div align="center">
<a href="http://techzone.forumpro.eu"><img src="http://i701.photobucket.com/albums/ww19/techzone_bucket/mini-banner.gif" alt="Techzone" title="Techzone" width="90" height="50" /></a> <a href="http://www.archonrpg.com/"><img src="http://www.archonrpg.com/media/waffleed.ico" border="0" alt="Waffle" title="Waffle" width="90" height="54" /></a> <a href="http://www.petitionspot.com/petitions/SaveSGA/"><img src="http://i652.photobucket.com/albums/uu241/rougewraith/SGA-1.jpg" alt="SaveSGA title="SaveSGA" width="90" height="50" /></a> <a href="http://www.forumotion.com/"><img src="http://www.illiweb.com/fa/banner/en/banner5.png" alt="free forum" title="forumotion.com" width="90" height="50" /></a> <a href="http://yoursmiles.org/"><img src="http://yoursmiles.org/img/sbutton.gif" alt="Free Smilies" title="Free Smilies" width="90" height="50" /></a> <a href="http://www.newgrounds.com/refer/rougewraith"><img src="http://img.ngfiles.com/fan-net/Noob-Antichrist2.gif" alt="Free Smilies" title="Free Smilies" width="90" height="50" /></a></div><br />
RoNo
RoNo
Active Poster

Male Posts : 1270
Reputation : 135
Language : English
Location : Laguna Beach, California

http://bf2mercenaries.forumotion.com/

Back to top Go down

Solved Re: javascript help plz

Post by Rougewraith July 12th 2009, 4:46 am

thx
Rougewraith
Rougewraith
Forumember

Posts : 99
Reputation : 0
Language : English
Location : Arkansas/Washington

http://godlingswrath.4umer.com

Back to top Go down

Solved Re: javascript help plz

Post by Sanket July 12th 2009, 5:11 am

Since this thread is marked solved, I will lock this thread.
Sanket
Sanket
Sanket
ForumGuru

Male Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum