DOM Tutorial 3

From Progzoo
Jump to: navigation, search

These question concern the monopoly documents. Your code is tested against three different documents http://progzoo.net/monopoly1.xml http://progzoo.net/monopoly2.xml and http://progzoo.net/monopoly3.xml

<!DOCTYPE game SYSTEM "monopoly.dtd">
<game>
 <board>
  <square label='GO'>
   <player id='dog'  cash='1500'/>
   <player id='ship' cash='1500'/>
   <player id='iron' cash='1500'/>
  </square>
  <square label='Old Kent Road' ref='old-kent-road'/>
  <square label='Community Chest'/>
  <square label='Whitechapel' ref='whitechapel'/>
  <square label='Income Tax (Pay 200)'/>
  <square label="King's Cross Station" ref='kings-cross'/>
 </board>
 <bank>
  <property id='old-kent-road' price='60'  colour='brown'/>
  <property id='whitechapel'   price='60'  colour='brown'/>
  <station  id='kings-cross'   price='200'/>
 </bank>
</game>

Number of child elements

Show the number of child elements.


[Font] [Default] [Show] [Resize] [History] [Profile]

Number of player elements

Print the number of player elements.



[Font] [Default] [Show] [Resize] [History] [Profile]

Square 3

Show the label of square element number 3.



[Font] [Default] [Show] [Resize] [History] [Profile]

Parent of player 1

Show the label of the parent of player number 1.



[Font] [Default] [Show] [Resize] [History] [Profile]

id of property 0

Show the id of property number 0.



[Font] [Default] [Show] [Resize] [History] [Profile]