IE 6 and 8 problem
-
Hi everybody, I have a CheckboxList on my web form and I have to display which check box have been ticked into List. the following code is working absolutely fine on IE 8 but not working on IE 6. I tried to change 'if' condition but failed to run same code on IE 6, main problem occurs in 'If' condition. thanks for any suggestion in adv. function readListControl() { var tableBody = document.getElementById('<%=cbsrc.clientId%>;').childNodes[0]; for (var i = 0; i < tableBody.childNodes.length; i++) { var currentTd = tableBody.childNodes[i].childNodes[0]; var listControl = currentTd.childNodes[0]; if (listControl.checked == true) alert('#' + i + ': is checked'); } } regards learner
-
Hi everybody, I have a CheckboxList on my web form and I have to display which check box have been ticked into List. the following code is working absolutely fine on IE 8 but not working on IE 6. I tried to change 'if' condition but failed to run same code on IE 6, main problem occurs in 'If' condition. thanks for any suggestion in adv. function readListControl() { var tableBody = document.getElementById('<%=cbsrc.clientId%>;').childNodes[0]; for (var i = 0; i < tableBody.childNodes.length; i++) { var currentTd = tableBody.childNodes[i].childNodes[0]; var listControl = currentTd.childNodes[0]; if (listControl.checked == true) alert('#' + i + ': is checked'); } } regards learner
This is bad code. It assumes a certain layout, and doesn't ever check if the object it is grabbing, exists. When you say it does not work, what is the problem ? Does it work in firefox ? Firebug helps you debug javascript. There are articles on CP about how to work with checked lists in javascript. Ideally you'd find a way to insert an id into each one so you could look up the elements by id instead of by array indices.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hi everybody, I have a CheckboxList on my web form and I have to display which check box have been ticked into List. the following code is working absolutely fine on IE 8 but not working on IE 6. I tried to change 'if' condition but failed to run same code on IE 6, main problem occurs in 'If' condition. thanks for any suggestion in adv. function readListControl() { var tableBody = document.getElementById('<%=cbsrc.clientId%>;').childNodes[0]; for (var i = 0; i < tableBody.childNodes.length; i++) { var currentTd = tableBody.childNodes[i].childNodes[0]; var listControl = currentTd.childNodes[0]; if (listControl.checked == true) alert('#' + i + ': is checked'); } } regards learner
if (listControl.tagName=='input' && listControl.type=='checkbox' && listControl.checked)
April Comm100 - Leading Live Chat Software Provider