我會自己編寫。
<script type="text/javascript">
var form=document.getElementById('myform');
var employers=document.getElementById('employers');
function addEmployer(currID) {
var employer = currID;
var nextEmployer = employer+1;
var employerclone=document.getElementById('employer[employer]').cloneNode(true);
employerclone.setAttribute('id', 'employer[(nextEmployer)]');
employers.appendChild(employerclone);
}
</script>
,然後形式:
<form id="myform">
<div id="employers">
<div id="employer[0]">
Employer Name:<input type="text" id="employerName[0]">
Employer Details:<input type="textarea" id="employerDeets[0]">
<input type="button" value="Add Employer" onclick="addEmployer(this.id)" id="0">
</div>
</div>
<input type="submit" value="submit">
</form>
這是沒有測試手段,只是潦草,但只是在我會去的方式。您還必須設置輸入的ID,以便在表單提交後不會與處理混淆。