By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,341 Members | 1,553 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,341 IT Pros & Developers. It's quick & easy.

strange label behavior in IE 6

P: n/a
Back again.

Despite changing the id in the form field and the corresponding 'for' in the
label IE still links the generated label to the form field it was cloned
from. Works in Firefox.

function selectfield(o){
var checked_owner_container =
document.getElementById('checked_owner_container') ;
var row = o.parentNode;
var new_checkbox = row.cloneNode(true);
checked_owner_container.appendChild(new_checkbox);
var checked_box = new_checkbox.firstChild;
var checked_box_label = checked_box.nextSibling;
var old_id = checked_box.id;
var new_id = 'js_' + old_id;
checked_box.setAttribute('id', new_id);
checked_box_label.setAttribute('for',new_id);
checked_box.checked = true;
checked_box.onclick=function(){deselectfield(this) ;}
}
Nov 29 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

James Carters wrote:

[snip]
checked_box.setAttribute('id', new_id);
checked_box_label.setAttribute('for',new_id);


This is a quick and hasty response, but you could try the following
instead:0

checked_box.id=new_id;
checked_box_label.htmlFor=new_id;

See

<URL:http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/input_checkbox.asp>

Regards

Julian Turner

Nov 29 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.