日期:2014-05-16 浏览次数:20828 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会话中...</title>
<body>
<div id="chat">
<div id="after"></div>
<div name="box">1</div>
<div name="box">2</div>
<div name="box">3</div>
<div name="box">4</div>
<div name="box">5</div>
</div>
<input type="button" onclick="doremove()" value="removebox4"/>
<input type="button" onclick="doadd()" value="addbox6"/>
<script type="text/javascript">
var i = 0;
function doadd()
{
var chat = document.getElementById("chat");
var after = document.getElementById("after");
var insert = document.createElement("div");
insert.name = "box";
insert.innerHTML = "新的" + i;
i++;
chat.insertBefore(insert,after.nextSibling);
}
</script>
</body>
</html>