WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Help Adding Radio Button - (DHTML/DOM) , Wendi, March 19, 2004
     Re:Help Adding Radio Button - (DHTML/DOM) , Ron (thewebkid), March 22, 2004

Subject: Re:Help Adding Radio Button - (DHTML/DOM) From: Ron (thewebkid) Date: March 22, 2004

Say this:

var oInput = document.createElement("<INPUT name=myRadio>");

name can't be set at runtime using the dom, you have to set them inline declaratively. Also, set oInput.checked = true; after you have appended the element fully. That should work.

Ron

From: Wendi
Sent: March 19, 2004
Subject: Re:Help Adding Radio Button - (DHTML/DOM)

Hello All --

Looking for assistance with dynamically adding a radio button in IE6+ and having it be "checkable."

oRow = oTable.insertRow();

oCell = oRow.insertCell();

oLabel = document.createElement("LABEL");

oLabel.innerHTML = "My Radio Button:";

oInput = document.createElement("INPUT");

oInput.setAttribute('id', 'radiobtn');

oInput.setAttribute('type','radio');

oInput.setAttribute('name','radio_set');

oInput.setAttribute('checked','true');

oLabel.appendChild(oInput);

oCell.appendChild(oLabel);

Two odd behaviors occur with this javascript code... 1) the radio box does not become "checked" as is set in the setAttribute code... 2) once the radio box is displayed on the page, it is un-checkable, you cannot select the radio button or deselect it... it's just blank and uncheckable.

Any ideas?

Thanks,

Wendi Turner





Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX