spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column37


JavaScript and Frames, Part II - The Famous Memory Game

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

In this column we continue the theme of the previous one - frames. Frames are easier to use than Dynamic HTML because they are browser-independent, simpler in syntax, and easier to program in JavaScript. We demonstrate the simplicity of frame-programming by showing you how to program the famous Memory game. Go ahead and play a few turns of Memory. As you can see, the game has two modes: single-player and double-player. The objective of the single-player version is to match all 32 pairs of images with the least number of attempts. The objective of the double-player version is to match more cards than your opponent.

We use frames in this Memory game for two reasons. First, we want to show you a simple usage of frames and JavaScript. Secondly, using frames makes the JavaScript script relatively short (under 200 lines) and fairly straightforward. The script does not have to check for the browser type, maker, or version -- it's all pure algorithms.

In this column we'll lead you through the design and implementation of the Memory game script, emphasizing the demonstrated usage of frames. The script includes ten functions and a global-variables section. We'll go through each one of them and explain their content in detail. In particular, we'll show you:

You can also view the full listing of the script and its zipped version.

More Resources from Doc JavaScript
Columns Popular Columns Tips Tools
Latest Columns
41-50 | 31-40 | 21-30
11-20 | 1-10
Working with Windows
JavaScript and Frames
Bookmarklets
Random Tips
Personalized Tips
RSS Channels
Menu Builder
Rollover Builder
Rotation Builder
Reference Tip Categories (want one?)
Links
For Your Site
Did you learn something? Do you like this site? Please link to us!

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: April 5, 1999
Revised: April 5, 1999

URL:http://www.webreference.com/js/column37/