views:

144

answers:

1

Hi,

see below html

<Div id="one">
 <Div id="two">

 </Div>
</Div>

when i am accessing div "two" with "document.getElementById("two")...am getting null.

+1  A: 

It worked for me.

<body onload="javascript:test();">
<Div id="one">
 <Div id="two">

 </Div>
</Div>


function test()
{
alert(document.getElementById("two"));
}

and I receive a messagebox which displays

[object]

Shoban