我有一个add方法,每点击一次按钮,添加一个DIV,DIV中包括一个复选框,一个button,一个文本框,但是这几个控件都紧挨在一起,我想把它们格开,怎么做???
解决方案 »
- 关于jquery ajax里面回调函数
- Flex中展开Tree时出现问题?
- 请教页面跳转无刷新的问题
- 救命啊,这样的javascript死活提示我网页有错误,明明刚刚还可以!
- 3层iframe如何互相访问
- 哪个有很多javascript效果的网站是什么
- 脚本切换界面传递值格式出错~~
- 我的一个asp页面中需要在一块区域中动态加载一个html的页面,这个页面的内容是预先设计好的,该如何实现?
- 紧急求助!help!!关于用javascript控制Media Player的问题??
- 如何用原生JS实现类似JQuery的多节点绑定同一事件?
- js怎么循环取得正则表达式全局匹配的所有数据
- JS效果求助,大家帮帮忙啊
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style type="text/css">
div {width:100;height:100;background:blue;margin:3;}
</style>
</HEAD> <BODY>
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
</BODY>
</HTML>
新手,不对见谅!
<html>
<head>
<title>c.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function add() {
var divBox = document.createElement("div");
var inpEl = document.createElement("input");
inpEl.type = "text";
var checkBoxEl = document.createElement("input");
checkBoxEl.type = "checkbox";
var btnEl = document.createElement("input");
btnEl.type = "button";
btnEl.value = "button";
divBox.appendChild(inpEl);
divBox.appendChild(document.createTextNode(" "));
divBox.appendChild(checkBoxEl);
//如果用innerHTML创建元素的话可以加 el.innerHTML = "<input type='text' /> "
divBox.appendChild(document.createTextNode(" "));
divBox.appendChild(btnEl);
document.getElementById("show").appendChild(divBox);
}
</script> </head>
<body>
<input type="button" value="添加" onclick="add()">
<div id="show"></div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>c.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function add() {
var divBox = document.createElement("div");
divBox.innerHTML = "<input type='text'/> <input type='checkbox'/> <input type='button' value='button'/>";
document.getElementById("show").appendChild(divBox);
} </script>
</head>
<body>
<input type="button" value="添加" onclick="add()">
<div id="show"></div>
</body>
</html>