i want to check if the TextBox3 which contains the id of a google marker exists in the lonListBox2 and if does update the value or if not, insert the value in the lonListBox2. now as it is the function makes no changes in the form , maybe the tagName doesn't exist.
here is the javascript function
<script type="text/javascript">
function addValue() {
var objOption;
var flag = false;
var objActiveSelect = document.getElementById('latListBox1');
objOption = document.createElement('option');
objOption.innerHTML = document.getElementById('TextBox1').value;
objOption.tagName = document.getElementById('TextBox3').value;
objActiveSelect.appendChild(objOption);
var objActiveSelect2 = document.getElementById('lonListBox2');
objOption = document.createElement('option');
objOption.innerHTML = document.getElementById('TextBox2').value;
objOption.tagName = document.getElementById('TextBox3').value;
alert(objActiveSelect2.childNodes.length.toString());
for(var i=0;i<objActiveSelect2.childNodes.length;i++)
{
if (objActiveSelect2.childNodes.item(i).tagName == document.getElementById('TextBox3').value) {
objActiveSelect2.childNodes.item(i).nodeValue = document.getElementById('TextBox2').value;
flag = true;
}
}
if (flag == false) {
objActiveSelect2.appendChild(objOption);
}
}
</script>