Go Back   Novahq.net Forum > Computers > Web design and Programming

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-09-2010, 02:32 AM
EDGE is offline EDGE
EDGE's Avatar

Join Date: Feb 2003
Location: North Carolina
Posts: 7,184

Send a message via ICQ to EDGE Send a message via AIM to EDGE Send a message via Yahoo to EDGE
Random Image Generator + Address?

So, i want to know if anyone can modify this javascript for me to make the random images appear as clickable links.

Any help is appreciated.

Code:
<script language="JavaScript">
<!--

function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="image1.gif"
myimages[2]="image2.gif"
myimages[3]="image3.gif"
myimages[4]="image4.gif"
myimages[5]="image5.gif"
myimages[6]="image6.gif"

var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<img src="'+myimages[ry]+'" border=0>')
}
random_imglink()
//-->
</script>
__________________
Quote:
Voltaire
It is forbidden to kill; therefore all murderers are punished unless they kill in large numbers and to the sound of trumpets.
Reply With Quote
  #2  
Old 12-09-2010, 08:04 AM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,355

Send a message via MSN to atholon
Code:
<script language="JavaScript">
<!--

function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="image1.gif"
myimages[2]="image2.gif"
myimages[3]="image3.gif"
myimages[4]="image4.gif"
myimages[5]="image5.gif"
myimages[6]="image6.gif"

var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<a href="'+myimages[ry]+'"><img src="'+myimages[ry]+'" border=0></a>')
}

//-->
</script>
__________________

My site: http://www.codeprotocol.com
"Bro, you are so full of win, if I slashed you with a kitchen knife, you'd be bleeding awesomeness." - Chrispy
Reply With Quote
  #3  
Old 12-09-2010, 09:03 AM
.Simon. is offline .Simon.

Join Date: Nov 2003
Location: Wales
Posts: 4,801

Assuming you want them to link to the images?
__________________

Quote:
Originally Posted by Steve View Post
next person to post half naked gets banned
Reply With Quote
  #4  
Old 12-09-2010, 10:28 AM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,355

Send a message via MSN to atholon
Yeah, what I posted assumes that. You'd need to link an array of addresses otherwise.
__________________

My site: http://www.codeprotocol.com
"Bro, you are so full of win, if I slashed you with a kitchen knife, you'd be bleeding awesomeness." - Chrispy
Reply With Quote
  #5  
Old 12-09-2010, 02:14 PM
EDGE is offline EDGE
EDGE's Avatar

Join Date: Feb 2003
Location: North Carolina
Posts: 7,184

Send a message via ICQ to EDGE Send a message via AIM to EDGE Send a message via Yahoo to EDGE
Quote:
Originally Posted by atholon View Post
Yeah, what I posted assumes that. You'd need to link an array of addresses otherwise.
No, actually reading my post I see that I wasn't clear with what I wanted at all lol. It was 5am, sorry, I was tired as hell.

I want the images to link to an outside like, like a forum post or something. So say I want the image to link to www.xoxide.com.
__________________
Quote:
Voltaire
It is forbidden to kill; therefore all murderers are punished unless they kill in large numbers and to the sound of trumpets.
Reply With Quote
  #6  
Old 12-09-2010, 03:32 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,355

Send a message via MSN to atholon
Yeah you'd just create another array and match the indexes;

Code:
<script language="JavaScript">
<!--

function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="image1.gif"
myimages[2]="image2.gif"
myimages[3]="image3.gif"
myimages[4]="image4.gif"
myimages[5]="image5.gif"
myimages[6]="image6.gif"

var imageLinks = new Array();
imageLinks[1]="www.google.com";
imageLinks[2]="www.blackzone.com";
imageLinks[3]="www.somethingstupid.com";
imageLinks[4]="www.ifailedsquared.com";
imageLinks[5]="www.blah.com";
imageLinks[6]="www.shiz.com";


var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<a href="'+imageLinks[ry]+'"><img src="'+myimages[ry]+'" border=0></a>')
}

//-->
</script>
__________________

My site: http://www.codeprotocol.com
"Bro, you are so full of win, if I slashed you with a kitchen knife, you'd be bleeding awesomeness." - Chrispy
Reply With Quote
  #7  
Old 12-09-2010, 03:58 PM
EDGE is offline EDGE
EDGE's Avatar

Join Date: Feb 2003
Location: North Carolina
Posts: 7,184

Send a message via ICQ to EDGE Send a message via AIM to EDGE Send a message via Yahoo to EDGE
Sweet! Thank you, kind sir!
__________________
Quote:
Voltaire
It is forbidden to kill; therefore all murderers are punished unless they kill in large numbers and to the sound of trumpets.

Last edited by EDGE; 12-09-2010 at 04:17 PM.
Reply With Quote
  #8  
Old 12-09-2010, 04:00 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,355

Send a message via MSN to atholon
Np
__________________

My site: http://www.codeprotocol.com
"Bro, you are so full of win, if I slashed you with a kitchen knife, you'd be bleeding awesomeness." - Chrispy
Reply With Quote
  #9  
Old 12-09-2010, 04:17 PM
EDGE is offline EDGE
EDGE's Avatar

Join Date: Feb 2003
Location: North Carolina
Posts: 7,184

Send a message via ICQ to EDGE Send a message via AIM to EDGE Send a message via Yahoo to EDGE
I have another question ath. Do you know of any scripts that show scrolling images, like the news image on this site - www.worldofwarcraft.com ? I'm not too sure what the script it called nor where to find one.
__________________
Quote:
Voltaire
It is forbidden to kill; therefore all murderers are punished unless they kill in large numbers and to the sound of trumpets.
Reply With Quote
  #10  
Old 12-09-2010, 05:56 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,355

Send a message via MSN to atholon
Ah, like a slideshow?

If that's what you're talking about then yeah, there's one called jcycle. It is way easy to use and it uses the jquery library. This is their site: http://jquery.malsup.com/cycle/
There might be a better one but that's the one I am using right now.
__________________

My site: http://www.codeprotocol.com
"Bro, you are so full of win, if I slashed you with a kitchen knife, you'd be bleeding awesomeness." - Chrispy
Reply With Quote
  #11  
Old 12-09-2010, 06:05 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,355

Send a message via MSN to atholon
BTW, if you want to use jCycle I'd look at the pager functionality and the other advanced options.
__________________

My site: http://www.codeprotocol.com
"Bro, you are so full of win, if I slashed you with a kitchen knife, you'd be bleeding awesomeness." - Chrispy
Reply With Quote
  #12  
Old 12-09-2010, 06:27 PM
EDGE is offline EDGE
EDGE's Avatar

Join Date: Feb 2003
Location: North Carolina
Posts: 7,184

Send a message via ICQ to EDGE Send a message via AIM to EDGE Send a message via Yahoo to EDGE
Thanks, bro. It works perfectly!
__________________
Quote:
Voltaire
It is forbidden to kill; therefore all murderers are punished unless they kill in large numbers and to the sound of trumpets.
Reply With Quote
  #13  
Old 12-09-2010, 07:00 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,355

Send a message via MSN to atholon
glad it works for yah.
__________________

My site: http://www.codeprotocol.com
"Bro, you are so full of win, if I slashed you with a kitchen knife, you'd be bleeding awesomeness." - Chrispy
Reply With Quote
  #14  
Old 12-09-2010, 08:00 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,877

Why do your arrays not start at zero? This makes me sad.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #15  
Old 12-09-2010, 08:48 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,355

Send a message via MSN to atholon
Hehe, I was going to mention that but figured I wouldn't to avoid confusing people.
__________________

My site: http://www.codeprotocol.com
"Bro, you are so full of win, if I slashed you with a kitchen knife, you'd be bleeding awesomeness." - Chrispy
Reply With Quote
  #16  
Old 12-10-2010, 05:56 AM
.Simon. is offline .Simon.

Join Date: Nov 2003
Location: Wales
Posts: 4,801

Quote:
Originally Posted by Scott View Post
Why do your arrays not start at zero? This makes me sad.
Hah, you can have a big Like.
__________________

Quote:
Originally Posted by Steve View Post
next person to post half naked gets banned
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Points Generator...Does this really work? Bustin Gaming Talk 5 04-12-2010 10:39 PM
Advertisement slogan generator! Steve General Chat 30 06-02-2005 02:29 PM
Squad Tag Generator Surge Web design and Programming 2 01-21-2004 05:52 AM
Random Tree/object Generator for TFD? RoDent Delta Force 2 05-13-2003 12:19 AM
Random Image Matt Web design and Programming 4 04-16-2003 04:14 PM


All times are GMT -5. The time now is 07:47 AM.




Powered by vBulletin®