Computer Hope
Internet & Networking => Web design => Topic started by: steven32collins on April 21, 2010, 02:14:53 AM
-
how can you make it so every time a page loads a random image is displayed out of an array of 2 - 3 but it cannot have a script (unless if you can make it work on signatures on a forum)
-
also this is the script ive got so far and when its inserted onto the webpage its modifyed
before added to the page
<script type="text/javascript">
//Javascript Created by Computerhope
//store the quotations in arrays
images = new Array(4);
images[0] = "<img src='http://www.computerhope.com/banners/banner.gif' />";
images[1] = "<a href = 'http://www.computerhope.com/history/index.htm'><img src='http://www.computerhope.com/banners/banner2.gif' alt='Computer History'>[/url]";
images[2] = "<a href = 'http://www.computerhope.com/index.htm'><img src='http://www.computerhope.com/banners/banner3.gif' alt='Visit Computer Hope'>[/url]";
images[3] = "<a href = 'http://www.computerhope.com/newslet.htm'><img src='http://www.computerhope.com/banners/banner4.gif' alt='Computer Hope Newsletter'>[/url]";
index = Math.floor(Math.random() * images.length);
document.write(images[index]);
//done
</script>
after its added to the page
<div class='signature'> </div>
<script type="text/javascript">
//Javascript Created by Computerhope
//store the quotations in arrays
images = new Array(4);
images[0] = "<img src='http://www.computerhope.com/banners/banner.gif' />";
images[1] = "<a href = 'http://www.computerhope.com/history/index.htm'><img src='http://www.computerhope.com/banners/banner2.gif' alt='Computer History'>[/url]";
images[2] = "<a href = 'http://www.computerhope.com/index.htm'><img src='http://www.computerhope.com/banners/banner3.gif' alt='Visit Computer Hope'>[/url]";
images[3] = "<a href = 'http://www.computerhope.com/newslet.htm'><img src='http://www.computerhope.com/banners/banner4.gif' alt='Computer Hope Newsletter'>[/url]";
index = Math.floor(Math.random() * images.length);
document.write(images[index]);
//done
</script>
<div> </div>
-
I don't really understand what you're trying to do.
-
right i have a couple of signatures i would like a random one to appear each time the page loads
now ive looked on the website it gave me the first script on my last post but when its inserted onto the forum the < on the script changes to < so then the script wont work please help :)
-
right i have a couple of signatures i would like a random one to appear each time the page loads
now ive looked on the website it gave me the first script on my last post but when its inserted onto the forum the < on the script changes to < so then the script wont work please help :)
you cannot use scripts on the forum.
-
you cannot use scripts on the forum.
...obviously.
-
well im kinda the guy who built the forum :)
how can i make it accseptible or work?
-
What forum are you talking about?
-
its made by invision power board
it uses ibf code aswell as html
-
Well, let me tell you it's not a good idea.
-
why?
-
Security. That's the whole idea behind removing the <script> tag from your signature. Anyone or anything could easily get into something they're not supposed to.
-
ok so how can i do it without the script tag?
-
what about php?
-
ok so how can i do it without the script tag?
HTML or CSS along cannot display a random image. PHP isn't allowed either.
-
ok what about the onmouseover atrabute for img tag
-
That's a script.
What you can do, though, is make an animated GIF image, like the userbars you'd see in some member's signatures.
-
ok thanks :)
what free program should i use?