topical media & game development

talk show tell print

game-javascript-casual-flipping-messages-game.htm / htm



  
  <!-- TWO STEPS TO INSTALL FLIPPER:
  
     1.  Paste the coding into the HEAD of your HTML document
     2.  Add the last code into the BODY of your HTML document  -->
  
  <!-- STEP ONE: Copy this code into the HEAD of your HTML document  -->
  
  <HEAD>
  
  <SCRIPT LANGUAGE="JavaScript">
  
  <!-- This script and many more are available free online at -->
  <!-- The JavaScript Source!! http://javascript.internet.com -->
  
  <!-- Begin
  var CurrentMsg = 'Hello?  Welcome to The JavaScript Source!!';
  function update(msg) {
  var pad_str="";                           
  n = msg.length;
  if(n<72) {
  pad = (73-n)/2;
  for(var i=0; i<pad; i++) {
  pad_str+=" ";                        
     }                        
  }                          
  CurrentMsg = pad_str + msg;                           
  document.messages.field.value = CurrentMsg;
  clearTimeout(timer);                           
  timer = setTimeout("idleMsg()",2500);        
  }
  function MakeArray(n) {                           
  this.length=n;                           
  for(var i = 1; i<= n; i++) {                                   
  this[i] = "";                
  }                           
  return(this);        
  }               
  var index = 1;           
  var notice_num = 9;                   
  var notices = new MakeArray(notice_num);        
  notices[1] = "Welcome to The JavaScript Source!";
  notices[2] = "Hey, thanks for coming!  I am glad you visited!";
  notices[3] = "Each message can be adjusted either in speed, or content.";        
  notices[4] = "The length of the message box can also be personalized to fit your needs.";
  notices[5] = "More scripts to this effect can be found throughout this site.";
  notices[6] = "Don't forget to get your own home page to show off all your scripts!"; 
  notices[7] = "I hope that these scripts help you to improve your web site!!";       
  notices[8] = "Be sure to sign my guestbook and complete my survey before you leave!";                     
  var timer = setTimeout('idleMsg()',1500);                   
  function nochange() {
  document.messages.field.value = CurrentMsg;        
  }                   
  function idleMsg() {                           
  update(notices[index++]);                           
  if(index>notice_num) { 
  index=1; 
     }  
  }
  // End -->                  
  </SCRIPT>
  
  <!-- STEP TWO: Put this code into the BODY of your HTML document  -->
  
  <BODY>
  
  <CENTER>
  <FORM name="messages" onSubmit="return false">
  <input type="text" name="field" size=73 value=" Hello?  Welcome to TJS!!" onFocus="self.status='This is a JavaScript information data field'; return true" onChange="nochange()">
  </FORM>
  </CENTER>
  
  <p><center>
  <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
  by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
  </center><p>
  
  <!-- Script Size:  2.62 KB  -->
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.