spacer

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

home / experts / javascript / column46


A DOM-Based Snakes Game, Part I (3)

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

The Game's DOM Tree

One of the DOM's advantages is that you can isolate the document's nodes you want to deal with via the DOM tree. You just put the relevant nodes under a single common father and access the subtree rooted at this father node. You don't need to bother with everything else in the document that is outside this subtree. We enclosed our Snakes' elements in a DIV element that we assigned the divNode id. Our code deals only with this node and its child nodes. The structure of the subtree is quite simple: one father node and 299 child nodes, arranged in a single array [0..298]. As explained in the previous page, 286 of these nodes are IMG nodes and the other 13 are BR nodes. Here is a sketch of the DOM tree:

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran


The Network for Technology Professionals

Search:

About Internet.com

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

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger


Created: August 16, 1999
Revised: August 16, 1999

URL: http://www.webreference.com/js/column46/analyze.html