Re: Help accessing elements of elements using the DOM

Hi Sam.

Samuel Goldenbaum:
> I am able to use the getElementById function to return the element with
> an id of 'level_7'. 
> 
> level  = document.getElementById('level_7');
> 
>  
> 
> I now need to get the element with an id of 'Colou1_1' and change some
> of its attributes.
> 
> color = level.getElementById('Colour1');
> 
>  
> 
> Yet this causes errors saying the object does not support this function?

Element ids are global, so there is no need to first get the 'level_7'
object and then get the 'Colour1' object.  Just do

  color = document.getElementByid('Colour1');

to get it.

Hope this helps,

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922

Received on Tuesday, 3 February 2004 23:09:14 UTC