Random Scripts

1 Conversation


Hmmm... not much use for these now, is there??? smiley -


This is two scripts using the 'random'-function. The first (1a and 1b) will show a different text on the page each time it's (re)loaded, the second (2) will load a random page when you click the link.

Texts or links are written inside quotation marks and seperated with commas as shown in the examples.
The number after the multiplication sign (in the examples '3') is the number of texts or links.

Surely someone could make some nicer scripts. I can't. smiley - bigeyes

If anybody wants to use the scripts, they are welcome to do so!

1a. Random Text



of 3

<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- RandomText by Ottox
var text = new Array ("Text no. 1","Text no. 2","Text no. 3")
var randNumb = Math.floor((Math.random()*3))
document.write(text[randNumb])
//-->
</SCRIPT>
of 3

1b. Random Text with a link



This is


Random text

This is
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- RandomText by Ottox
var text = new Array ("Text no. 1","Text no. 2","Text no. 3")
var randNumb = Math.floor((Math.random()*3))
document.write(text[randNumb])
function rload() {
self.location = self.location
}
//-->
</SCRIPT>
<BR />
<A HREF="javascript:rload()" ONMOUSEOUT="window.status=''" ONMOUSEOVER="window.status='Random text';return true">
Random text</A>

2. Random Link



This link will take you either to my page, to the GuideML-Clinic or to the Quick Reference Guide

Random link

This link will take you either to my page, to the GuideML-Clinic or to the Quick Reference Guide
<BR />
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- RandomLinks by Ottox
var newURL = new Array ("U150740","GuideML-Clinic","A344756")
var randNumb = Math.floor((Math.random()*3))
function randLink(link) {
location = (link)
}
//-->
</SCRIPT>
<A HREF="javascript:randLink(newURL[randNumb])" ONMOUSEOUT="window.status=''" ONMOUSEOVER="window.status='Random link';return true">Random link</A>

Places to go from here


Pick a LinkPulldown Link List (the code for this list)The GuideML ClinicGuideML GadgetsBruce (GuideML Guru)The Gurus' Home PageOttox

Bookmark on your Personal Space


Conversations About This Entry

Entry

A449958

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Written and Edited by

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more