Raghuram Banda wrote:
[color=blue]
> The following is the function I used to create RADIO buttons using DOM.
> It works fine with Netscape but not with IE.
> function addGroup3Radio() {
> var cellId = document.getElementById("cell1");
> for(var i=0; i < arrData.length; i++) {
> var objRadItem = document.createElement("input");
> objRadItem.type = "radio";
> objRadItem.name = "radGroup";
> objRadItem.id = "idrad_" + i;
> objRadItem.value = arrData[i][0];
>
> if(i == 1) {
> objRadItem.defaultChecked = true;
> objRadItem.checked = true;
> }
> var objTextNode = document.createTextNode(" " + arrData[i][1]);
> var objLabel = document.createElement("label");
> objLabel.htmlFor = objRadItem.id;
> objLabel.appendChild(objRadItem);
> objLabel.appendChild(objTextNode);
>
> var objBreak = document.createElement("br");
>
> cellId.appendChild(objLabel);
> cellId.appendChild(objBreak);
> }
> document.forms["FirstFormName"].addRadio.disabled = true;
> }
>[/color]
What is not working with IE? I guess the radio buttons are inserted
fine, the only thing that IE/Win doesn't support is then to allow access to
document.forms.formName.elements.radGroup
as documented at
http://msdn.microsoft.com/workshop/a...ies/name_2.asp
which explains that you cannot set name on elemens created dynamically
with createElement. The suggestion there is to use the IE only
document.createElement('<input type="radio" name="radGroup">')
--
Martin Honnen
http://JavaScript.FAQTs.com/