日期:2014-05-16 浏览次数:20947 次
<!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>
<style>
body{font-size:16px;}
ul{margin:0;padding:0;}
li{list-style:none; vertical-align:top;}
.cf:after{content:'';display:block;clear:both;}
.cf{zoom:1;}
.list{width:980px; margin:0 auto;}
.list li{height:50px;border:solid 2px #06F; text-align:center;line-height:50px;margin-bottom:20px;}
</style>
<script>
window.onload=function(){
var oBtn=document.getElementById('btn');
var oUl=document.getElementById('list') ;
var i=0;
oBtn.onclick=function(){
var li = document.createElement('li');
li.innerHTML=i++;
oUl.appendChild(li);
}
}
</script>
</head>
<body>
<p>点击按钮添加记录</p>
<input type="button" id="btn" value="添加"/>
<ul class="list" id="list">
</ul>
</body>
</html>