QUB1
March 29, 2024, 02:31:52 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Gallery Staff List Login Register  

[CODE] Random Message Popup WITH button

Pages: [1]
  Print  
Author Topic: [CODE] Random Message Popup WITH button  (Read 343 times)
Qub1
Administrator
Newbie
*****

Rate: +0/-1
Posts: 13


View Profile
« on: March 18, 2009, 11:48:16 am »

Welcome. This code will simply put a button of your forum, and when clicked, displays a random message.

Put this in your Footers:
Quote
<center><form action="#" onsubmit="return get_quote();">
<input type="submit" value="BUTTON TEXT" />
</form></center>
<script type="text/javascript">
<!-- Random Message -->
<!-- This script is made by Qub1. Find more scripts like this at http://qub1.smfforfree.com/ -->
function get_quote()
{
  var quote=new Array()
     quote[0]="MESSAGE1";
     quote[1]="MESSAGE2";
     quote[2]="MESSAGE3";
  var ran_num= Math.floor(Math.random()*(quote.length));
  window.alert(quote[ran_num]);
  return false;
}</script>

Replace BUTTON TEXT with the text you want to be on the button, and replace MESSAGE1,2 or 3 with a random message. To add more messages, add more lines like this:
Quote
     quote[X]="MESSAGE";
Replace the X with the message number, like if the above one was 0, this one would be 1 and so on...

Thanks for reading!
~ Qub1
« Last Edit: March 18, 2009, 11:51:57 am by Qub1 » Report Spam   Logged

Share on Facebook Share on Twitter


Pages: [1]
  Print  
 
Jump to: