if you want to add a new button, try<script language="javascript">
function addBtn()
{
var btn = document.createElement("INPUT");
btn.type="button";
btn.value = "new";
btn.onclick= function(){alert("hello")};
document.frmtest.appendChild(btn);
}
</script>
<form name="frmtest">
<input type="button" value="add another button" onclick="addBtn()">
</form>
function addBtn()
{
var btn = document.createElement("INPUT");
btn.type="button";
btn.value = "new";
btn.onclick= function(){alert("hello")};
document.frmtest.appendChild(btn);
}
</script>
<form name="frmtest">
<input type="button" value="add another button" onclick="addBtn()">
</form>
<div id=b>
</div>
<script>
function f(){
b.innerHTML="<input type=button value='new button'>";
}
</script>