Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Group info
Members: 21
Language: English
Group categories:
Computers > Databases
Computers > Programming
Computers
More group info »
Recent pages and files
synchronous-randomization-with-javascript-arrays    

The random number methods of Math object have been present inJavaScript for ever and have been put to good use time and time againin all manner of scenarios. One thing that the random method can easilydo is display a random image on, say, your homepage. It may sound likea small thing but this randomization can be put to incredibly good usewith just a little bit of planning and an easy bit of JavaScript. Thisone-part article will discuss the use of a multidimensional array and abasic randomization script to create a section of a page that randomlydisplays a series of images, complete with synchronous roll-overs,links and captions. This could be a useful addition to any site andprovide a visual incentive for visitors to select products from aclearance or special offer section of your online store for example.Best of all, the code is compact, minimal and entirely client-side soif you don't have full access to server-side script languages on yourweb-hosts server, you can still implement it.

A lot of people,especially those new to JavaScript coding, shy away from arraysthinking them complex and unnecessary. For multidimensional arrays thatfear is cubed. But arrays of any kind are the cornerstones of many ofthe most useful applications of JavaScript, and have featured in oneway or another in most of my previous articles. In addition to asolitary text editor, you'll also need a stock of images to make theresulting page work. I've included the images that I've used in thistutorial to save you the hassle of finding and formatting images ofyour own. Feel free to use them in any context as they are free fromcopyright or royalty restrictions.

As a web developer, you'lloften need to use graphics or photos in your pages. Finding a readysupply of images to satisfy your unending need used to be a realproblem, but thankfully you can now use the excellent Yotophoto (http://yotophoto.com), which is the first search engine dedicated solely to allowing you to search a huge index of completely free images.

?

Version: 
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google