Bored scripts

by Elm

Elm
Senior Member
Kohai
Posts: 402
Threads: 30
Joined: Sep 2016
Reputation: 0
03-25-2016, 07:37 AM
#54588 (1)
First I would like to say this wasnt stolen from @meanwhile  :steve:

So yeaaaaaaaaaah I was bored and made this thing to change my cool logo.  :hype:
It really just generates random number and every number has custom logo url(currently only 2).

Spoiler

Code:
function getImagesByAlt(alt) {
   var allImages = document.getElementsByTagName("img");
   var images = [];
   for (var i = 0, len = allImages.length; i < len; ++i) {
       if (allImages[i].alt == alt) {
           images.push(allImages[i]);
       }
   }
   return images;
}

var logo = getImagesByAlt("Weabooboo Forums")[0];

function ChooseRandom()
{
   var number = Math.floor(Math.random() * (2 - 1 + 1)) + 1;
   if(number == 1) { logo.src = "http://i.imgur.com/B824cr7.gif" }
   if(number == 2) { logo.src = "https://i.imgur.com/w5uY0Vx.png" }
}
ChooseRandom();
Yoko
Uguu
Waifu
Posts: 1,393
Threads: 78
Joined: Feb 2016
Reputation: 1
03-25-2016, 10:27 AM
#54613 (2)
That's cool man :yokoplz:
Hopefully I can understand this soon as I'm trying to learn lol

[Image: 687474703a2f2f693135302e70686f746f627563...672e706e67]