Everything E-Commerce Everything E-Commerce

Don't take chances with your on-line store!
 
JUST FOR FUN
Click an arrow to visit the application.

ALL THE STUFF THAT'S LEFT HANDED  

PLAY OUR SLOT MACHINE, WIN NOTHING

GET RID OF THE DOUBLE CLICK SUBMIT

FIX THAT JAVASCRIPT NUMBER

KEEP TABS ON THE HEALTH OF YOUR COLDFUSION SERVER

CREATE A DYNAMIC BAR CHART

PLAY OUR SLOT AND PLAY WITH DHTML (give images time to preload)
If you ever wondered why people love to play a slot machine, give this one a try. Even without money or prizes, there is something compelling and frustrating about playing the machine. Our guess is that the reason has to do with control over your situation....in this case the machine environment. It's something like trying to get a computer to do what you want.

 PLAY TO WIN A FREE  webPEDDLE™  STOREFRONT
Just kidding; webPeddle™ is already free!    Click the handle to begin.

 HERE IS THE "PLAY" FUNCTION CODE
function play(){
	var timer = clearTimeout(timer)
	document.winn.src = pix[7].src;
	document.p1.src = pix[5].src;
	document.p2.src = pix[5].src;
	document.p3.src = pix[5].src;
	var i = 4 * Math.random();
	var i = Math.floor(i);
	setTimeout('document.p1.src = pix[' +i+ '].src', 1000)
	var j = 4 * Math.random();
	var j = Math.floor(j);
	setTimeout('document.p2.src = pix[' +j+ '].src', 1500)
	var k = 4 * Math.random();
	var k = Math.floor(k);
	setTimeout('document.p3.src = pix[' +k+ '].src', 2000)
	if(i == j && j == k){
	setTimeout('document.winn.src = pix[8].src', 2250);}
	}
If the code above is unreadable because of your screen resolution, just copy and paste to a simple text editor.
 HOW IT WORKS
JavaScript and the document object combine to make DHTML (Dynamic Hypertext Markup Language). By identifying images with a name, JavaScript can be used to change the image on a page by changing the image src associated with that name. In this case all of the images get preload to the browser by assinging them as values of an image array:
pix[0] = new Image(84,59);
pix[0].src = "mystore1.gif";
......etc
The "play()" function simply swaps the images based on the integer value of a randum number.

DHTML is not consistently supported across browsers and browser versions. This code works best with IE 4.x. Something screws the image sizes in NN 4.x.

Writing code is like wrestling alligators:
  The more you thrash around, the more gators join the fray!

site | company | products | services | articles
ImagineNation © 1996 - 2003