Monday, February 2, 2015

Javascript Function beautiful floating hello world notice

Javascript Space Puppy

Javascript Function For circular Ball or earth

A beautiful set of ball linking with each other on near contact.

Random Maze Generator Source Code

Javascript slide show

<SCRIPT>var myPix = new Array("images/pathfinder.gif", "images/surveyor.gif", "images/surveyor98.gif");
var thisPic = 0;
function processPrevious() {
     if (document.images && thisPic > 0) {
          thisPic--;
          document.myPicture.src = myPix[thisPic];
     }
}
function processNext() {
     if (document.images && thisPic < 2) {
          thisPic++;
          document.myPicture.src = myPix[thisPic];
     }
}
</SCRIPT>
<IMG SRC="images/pathfinder.gif" NAME="myPicture">
<HREF="javascript:processPrevious()">Previous</A>
<
HREF="javascript:processNext()">Next</A>

Javascript function determines whether a Credit Card number is "valid"

// The function determines whether a Credit Card number is "valid"
// Please note that a "valid" Credit Card number is not essentially a Credit Card in "Good Standing"
function isValidCreditCard(number) {
     if (number.indexOf("-")) {
          cc = number.split("-");
          number = "";
          for (var i = 0; i < cc.length; i++) number += cc[i];
     }
     // Another Version of what was performed above using String & Array Methods
     if (number.
indexOf(" ")) {
          cc = number.
split(" ");
          number = cc.
join("");
     }
     // OR using RegExp we can combine the above two
     
//  number = number.replace(/-|\s/g, "");
     /**********************************************/
     if (number.length > 19) return (false);
     sum = 0; mul = 1; l = number.length;
     for (i = 0; i < l; i++) {
          digit = number.substring(l - i - 1, l - i);
          tproduct = parseInt(digit, 10) * mul;
          if (tproduct >= 10) sum += (tproduct % 10) + 1;
          else sum += tproduct;
          if (mul == 1) mul++;
          else mul--;
     }

     if ((sum % 10) == 0) return (true);
     else return (false);
}