id的设置问题,急用
在IE下,
var ss = document.createElement( "div ");
ss.setAttribute( "id ", "ddd ");
alert(document.getElementById( "ddd "));
或者
var ss = document.createElement( "div ");
ss.id = "ddd ";
alert(document.getElementById( "ddd "));
都不对,请问该怎么设置这个id啊(IE)
------解决方案-------------------- <script>
var div = document.createElement( 'div ');
div.id = 'div1 ';
div.innerHTML = '111 ';
document.documentElement.appendChild(div);
alert(document.getElementById( 'div1 ').innerHTML);
</script>