日期:2014-05-16  浏览次数:20413 次

DIV 问题,这个问题比较简单,但解决不知道怎么解决
<DIV   id= "d1 "> <bgsound   src= 'OK.mid '   loop= '1 '   /> </DIV>
这个层已经显示,然后需要多次加入下面的字符串

  getElementByID( "d1 ").innerHTML+= "test <br   /> ";  


但每次都听到声音,请问如何只能一次声音,类似的bgsound有几百行,笨方法肯定不行


------解决方案--------------------
var str = " ";
str+= "test <br /> ";
getElementByID( "d1 ").innerHTML = str;



------解决方案--------------------
<DIV id= "d1 "> <bgsound src= 'OK.mid ' loop= '1 ' /> </DIV>
这个层已经显示,然后需要多次加入下面的字符串

<script type= "text/javascript ">
var myd=document.getElementById( "d1 ");
var myt=document.createTextNode( "text ")
myd.appendChild(myt);
</script>
------解决方案--------------------
<script type= "text/javascript ">
var myd=document.getElementById( "d1 ");
var myt=document.createTextNode( "text ")
myd.appendChild(myt);
</script>
这可以
------解决方案--------------------
<script language= "javascript " type= "text/javascript ">
function add()
{
var old_div = document.getElementById( "d1 ");
var parentElement = old_div.parentElement;

var new_div = new Object();
new_div = document.createElement( "div ");
new_div.setAttribute( "id ", "d1 ");
new_div.innerHTML = old_div.innerHTML+ "test <br> ";
new_div.style.position = "absolute ";
new_div.style.top = old_div.style.top;
new_div.style.left = old_div.style.left;

old_div.parentNode.removeChild(old_div);
document.body.appendChild(new_div);

}