<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "//w3c//DTD XTML 1.0 strict//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PrashantAnand</title>
<script type="text/javascript">
var element_number=0;
var objarray = new Array();
function add(){
element_number += 1;
var a=document.getElementById("click");
var inpt=document.createElement("input");
inpt.setAttribute("type","text");
inpt.setAttribute("id","input"+ element_number);
a.appendChild(inpt);
objarray[objarray.length] = inpt;
}
function removeLast()
{
document.getElementById("click").removeChild(objarray[objarray.length-1]);
objarray.splice(objarray.length-1,1);
}
</script>
</head>
<body style="background:black;">
<input type="submit" value="Add Item" OnClick="add()" id="sub_add"/>
<input type="submit" value="Remove Item" id="remove" onclick="removeLast()"/>
<div id="click">
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "//w3c//DTD XTML 1.0 strict//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PrashantAnand</title>
<script type="text/javascript">
var element_number=0;
var objarray = new Array();
function add(){
element_number += 1;
var a=document.getElementById("click");
var inpt=document.createElement("input");
inpt.setAttribute("type","text");
inpt.setAttribute("id","input"+ element_number);
a.appendChild(inpt);
objarray[objarray.length] = inpt;
}
function removeLast()
{
document.getElementById("click").removeChild(objarray[objarray.length-1]);
objarray.splice(objarray.length-1,1);
}
</script>
</head>
<body style="background:black;">
<input type="submit" value="Add Item" OnClick="add()" id="sub_add"/>
<input type="submit" value="Remove Item" id="remove" onclick="removeLast()"/>
<div id="click">
</div>
</body>
</html>
No comments:
Post a Comment