追加子节点不在firefox中工作

时间:2013-08-17 14:11:22

标签: javascript html dom

将新的span节点附加到不在Mozila FF中工作的li节点

im code is

<html>
<head>
<title>Mozila Test</title>
<script>
function ThatsIt()
{
    alert("dfasd");
    var div1=document.getElementById('dv1');
    var sd=document.createElement('div');
    sd.innerHTML="asgfkasdhfjhasdfhdhasf";
    div1.appendChild(sd);

    var ultag=document.createElement("ul");
    sd.appendChild(ultag);

    var litag=document.createElement("li");
    litag.id="mouseleave-outerBox1";
    litag.className="listelements";
    litag.style.fontWeight="bold";               
    litag.name="asddasggd";                             
    var parentmenuspan=document.createElement("span");      
    parentmenuspan.className="horz_span";
    parentmenuspan.innerText="adsgasdgasdgasdg";
    litag.appendChild(parentmenuspan);
    ultag.appendChild(litag);

}
</script>
</head>
<body>
<div id="dv1">

</div>
<input type="button" id="b1" name="b1" onclick="ThatsIt()"/>
</body>
</html>

当我在chrome中运行此程序时,即它工作正常但在FF中它显示为空白。

帮助Plz !!!!!!!

0 个答案:

没有答案