|
|
|
date: Tue, 12 Apr 2005 00:45:03 -0700,
group: microsoft.public.msdn.drgui.drguidotnet.discussion
back
HTML Javascript error in IE
Hi ,
I fill a dropdownlist with some values say 3 values. then i clone the
dropdownlist and try to add 5 items in the cloned dropdown.
Problem#1
the cloned object does not show me more than 3 items in it.
Problem#2
also if i delete the items in the cloned object it will still show me 3
items with blanks values in it.
Adding the code this show you what i'm trying to do.
Thanks in advance.
-----------------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
function CallClone()
{
//var row = table.rows[lastrow].cloneNode(true);
//table.tBodies[0].appendChild(row);
var list = document.getElementById('select');
var cloneList = list.cloneNode(true);
list.parentElement.appendChild(cloneList);
var lists = document.getElementsByName('select1');
alert (lists.length);
appList(lists[1],[['a','q'],['b','b'],['c','c'],['d','e'],['z','d']],false);
if (lists[2])
appList(lists[2],[['a','q'],['b','b']],true);
}
function appList(obj,list,bDel)
{
if (bDel) for(var i=obj.childNodes.length-1; i>=0; i--)
obj.removeChild(obj.childNodes[i]);
else
{
alert(bDel)
for(var i=obj.childNodes.length-1; i>=0; i--)
obj.removeChild(obj.childNodes[i]);
for(var i=0; i<list.length; i++){
option =document.createElement('option');
option.innerHTML = list[i][1];
option.value = list[i][0];
obj.appendChild(option);
}
}
}
function fillCombo()
{
var cbo1 = document.getElementById('select');
//var arr = ['1'],['1','34'],['2']['12','22'];
//appList(cbo1,arr);
}
</script>
</head>
<body onLoad="fillCombo()">
<form name="form1" method="post" action="">
<p>
<select id="select" name="select1">
<option value="Test">1</option>
<option value="test2">2</option>
<option value="test3">3</option>
</select>
</p>
<p>
<input type="button" name="click" value="click" onClick="CallClone()" >
</p>
</form>
</body>
</html>
-----------------------------------------------------------------------------------------------
date: Tue, 12 Apr 2005 00:45:03 -0700
author: Sandeep S Kulkarni Sandeep S
RE: HTML Javascript error in IE
"Sandeep S Kulkarni" wrote:
> Hi ,
>
> I fill a dropdownlist with some values say 3 values. then i clone the
> dropdownlist and try to add 5 items in the cloned dropdown.
> Problem#1
> the cloned object does not show me more than 3 items in it.
> Problem#2
> also if i delete the items in the cloned object it will still show me 3
> items with blanks values in it.
>
> Adding the code this show you what i'm trying to do.
>
> Thanks in advance.
>
> -----------------------------------------------------------------------------------------------
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <script language="javascript">
> function CallClone()
> {
> //var row = table.rows[lastrow].cloneNode(true);
> //table.tBodies[0].appendChild(row);
>
> var list = document.getElementById('select');
>
> var cloneList = list.cloneNode(true);
> list.parentElement.appendChild(cloneList);
> var lists = document.getElementsByName('select1');
> alert (lists.length);
>
>
> appList(lists[1],[['a','q'],['b','b'],['c','c'],['d','e'],['z','d']],false);
>
> if (lists[2])
> appList(lists[2],[['a','q'],['b','b']],true);
>
>
>
> }
> function appList(obj,list,bDel)
> {
> if (bDel) for(var i=obj.childNodes.length-1; i>=0; i--)
> obj.removeChild(obj.childNodes[i]);
> else
> {
> alert(bDel)
> for(var i=obj.childNodes.length-1; i>=0; i--)
> obj.removeChild(obj.childNodes[i]);
> for(var i=0; i<list.length; i++){
> option =document.createElement('option');
> option.innerHTML = list[i][1];
> option.value = list[i][0];
> obj.appendChild(option);
> }
> }
> }
>
> function fillCombo()
> {
> var cbo1 = document.getElementById('select');
> //var arr = ['1'],['1','34'],['2']['12','22'];
> //appList(cbo1,arr);
>
>
> }
> </script>
> </head>
> <body onLoad="fillCombo()">
> <form name="form1" method="post" action="">
> <p>
> <select id="select" name="select1">
> <option value="Test">1</option>
> <option value="test2">2</option>
> <option value="test3">3</option>
> </select>
> </p>
> <p>
> <input type="button" name="click" value="click" onClick="CallClone()" >
> </p>
> </form>
> </body>
> </html>
> -----------------------------------------------------------------------------------------------
date: Tue, 12 Apr 2005 00:50:01 -0700
author: Sandeep S Kulkarni
|
|