Archive for Manchester United Fans Forum For All Manchester United Fans From Across The World!
 



       Manchester United Fans Forum Index -> General Discussion
Viralize

[CODE] Random Quote Generator onClick

Date Made: 15th October, 2007

What it does: You assign quotes. Then, wherever you place the code, there will be a button which, if you click will bring up a pop-up-box with a random quote from what you assigned. Pop-ups will need to be allowed for z3.invisionfree.com .

Copyright: In the code, do not remove.

Preview: http://z3.invisionfree.com/forumclocktest/index.php

Coding (In Code or Quote tags):

Footers
Quote:

<!--
Random Quote Generator by Viralize of http://www.ZetaResources.com/
//-->


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

var nofquo=5

function get_random()
{
var ranNum= Math.floor(Math.random()*nofquo);
return ranNum;
}

function getaQuote()
{
var quoteran=get_random();

var quote=new Array(nofquo)
quote[0]="Quote1";
quote[1]="Quote2";
quote[2]="Quote3";
quote[3]="Quote4";
quote[4]="Quote5";


alert(quote[quoteran]);
}
//-->
</script>


Change this number to the amount of quotes you are using.
Change the text in the double quotations to whatever quotes you want. The number in straight brackets after 'Quote' needs to be increased by 1 for each quote, starting at 0.

For another quote, add:

Quote:

quote[number]="New Quote Text";


With the red text to be edited accordingly.



Paste wherever you want the button to appear:
Code:

<body>
<form name="form1">
<input type="button" value="Generate Quote" onClick="getaQuote()">
</form
</body>
NoOnAn-2k7

erm ok thanks!!
Viralize

Lol. It isn't much, but it was made as a request, so Ifelt like posting it here for people to use freely, as long as the copyright is intact.
NoOnAn-2k7

thats grand thanks a lot ur a new member and already uve done more than some!!!

       Manchester United Fans Forum Index -> General Discussion
Page 1 of 1
Create your own free forum | Buy a domain to use with your forum