87,843
社区成员




<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.8.3/jquery.min.js"></script>
<style type="text/css">
</style>
<script>
$(document).ready(function(){
$(document).on('click','.addone', function(){
var str = "<div class='xhdz'><input type='text' name='xhmc[]' style='width:100px;margin-right:10px;' value='' /><input type='text' name='xhdz[]' class='intxt' value='' /><a href='javascript:void(0)' class='addone'>添加一条</a><a href='javascript:void(0)' class='delone''>删除</a></div>";
$(this).parent().after(str);
$('.delone').click(function(){
$(this).parent().remove();
});
});
});
</script>
</head>
<body>
<div class='xhdz'><input type='text' name='xhmc[]' style='width:100px;margin-right:10px;' value='' /><input type='text' name='xhdz[]' class='intxt' value='' /><a href='javascript:void(0)' class='addone'>添加一条</a></div>
</body>
</html>
<!DOCTYPE html>
<script src="https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superplus/js/lib/jquery-1.10.2_d88366fd.js"></script>
<script>
$(document).ready(function () {
var addoneAction = function () {
var str = "<div class='xhdz'><input type='text' name='xhmc[]' style='width:100px;margin-right:10px;' value='' /><input type='text' name='xhdz[]' class='intxt' value='' /><a href='javascript:void(0)' class='addone'>添加一条</a><a href='javascript:void(0)' class='delone''>删除</a></div>";
$(this).parent().after(str);
$('.addone').unbind('click').bind('click', addoneAction);
$('.delone').unbind('click').bind('click', deloneAction);
};
var deloneAction = function () {
$(this).parent().remove();
};
$('.addone').unbind('click').bind('click', addoneAction);
});
</script>
<html lang="en">
<head>
<title>HTML</title>
</head>
<body>
<div class='xhdz'>
<input type='text' name='xhmc[]' style='width: 100px; margin-right: 10px;' value='' /><input
type='text' name='xhdz[]' class='intxt' value='' /><a href='javascript:void(0)' class='addone'>添加一条</a></div>
</body>
</html>