kindly check the CODE**
<html>
<head>
<title>DOM ADD?REMOVE UL-LI..... NODE DEMO 09/08/2010 </title>
<style type="text/css">
ul{margin: 0;
padding: 0;
left: 20px;
width: 90%;
border-bottom: solid 1px #d09800;
}
li{
color: #333 !important;
background: white;
text-decoration: none;
}
#menu li{
height:15px;width:90px;
cursor:pointer;
border:1px solid #95aea5;
background:#EFF8FD;
padding-bottom:6px;
margin-top:2px;
text-align:center;
list-style:none;
}
</style>
<script type="text/javascript">
var TDCount = 3;
var i=0;
function insertTD(){
var possition=document.getElementById('elmnt_pos').value;
if(possition=="")
{
possition='a';
alert('Enter a number!!!');
}
if(isNaN(possition))
{
alert('Enter a number!!!');
document.getElementById('elmnt_pos').value='';
}else{
var newTD = document.createElement("li");
var newid='li'+TDCount++;
newTD.setAttribute("id", newid);
newTD.setAttribute("onclick","javascript:removenode(this);" );
var newText = document.createTextNode(i+"New fruit " + (possition++));
newTD.appendChild(newText);
var trElm = document.getElementById("menu");
var refTD = trElm.getElementsByTagName("li").item(possition-2);
trElm.insertBefore(newTD,refTD);
i++;
}
}
function removenode(th)
{
answer = confirm("Do you really want to Remove Element "+th.id + " ? ")
if (answer !=0)
{
document.getElementById('menu').removeChild(document.getElementById(th.id));
}
}
</script>
</head>
<body>
<ul id="menu">
<li id="li0" onclick="javascript:removenode(this);">apple</li>
<li id="li1" onclick="javascript:removenode(this);">Banana</li>
<li id="li2" onclick="javascript:removenode(this);">Jackfruit</li>
</ul>
<form name="justfrm">
<input type="text" value="Enter the position" name="pos1" id="elmnt_pos" />
<input type="button" value="click" onclick="javascript:insertTD()"/>
</form>
</body>
</html>
"Enter the position" means add element on a specific position like 2,3,5 etc. We can Delete Item by click on item . My problem is that the DELETE ITEM (Item which has been added dynamically) is not deleteing by click in IE6. Kindly any one help me about this DOM matter?