Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Display a pice of code at random from a set of options
Old 07-20-2012, 06:47 AM Display a pice of code at random from a set of options
Spud In Disguise's Avatar
Super Spam Talker

Posts: 815
Location: UK... where else?
Trades: 0
Hi guys, I know this must be stupidly simple but can someone help me work out how to achive this:

I would like to have a JS file with a selection of different pieces of code in it. Then on my web page I'd like to call one of those pieces of code, at random, and display it. This would change upon page refresh.

I'd like to learn how to do this myself so am really only looking for basic pointers. I've tried googling various terms but nothing seems to be throwing up what I'm after...

Thanks
__________________

Please login or register to view this content. Registration is FREE
Spud In Disguise is offline
Reply With Quote
View Public Profile Visit Spud In Disguise's homepage!
 
 
Register now for full access!
Old 07-20-2012, 12:19 PM Re: Display a pice of code at random from a set of options
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.modtalk.co.uk/_site/code/.../random-image/

If Google says it is an "attack" site you can ignore it, I have run numerous scans on the server and cannot find anything malicious and no files have been changed recently when I run a date search.


Shows random images.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-20-2012, 12:31 PM Re: Display a pice of code at random from a set of options
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Don't forget to wrap your code in <pre> tags and convert < and > to HTML entities.

tycoontalk.freelancer.com/html-forum/63407-display-code.html
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Display a pice of code at random from a set of options
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20534 seconds with 11 queries