- 爱易网页
-
JavaSript
- Js兑现点击按钮创建删除div
日期:2014-05-16 浏览次数:20421 次
Js实现点击按钮创建删除div
<html>
<head>
</head>
<body>
<div id='div1'></div>
<input type = 'button' onclick='addElement()' value='我手贱~添一个元素~我手贱~'>
<input type = 'button' onclick='dropElement()' value='嗯,我删死你!!'>
</body>
<script>
var i = 1;
function addElement(){
var div = document.createElement('div');
div.style.backgroundColor = 'red';
div.style.fontSize = '100px';