开发者

inner DIV not accessible using document.getElementById

开发者 https://www.devze.com 2022-12-17 11:17 出处:网络
see below html <Div id=\"one\"> <Div id=\"two\"> <开发者_如何学C;/Div> </Div>

see below html

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

 <开发者_如何学C;/Div>
</Div>

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


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]

0

精彩评论

暂无评论...
验证码 换一张
取 消