Hi All,
I have looked around for an answer to this question, but haven't found
one as of yet. I'm trying to use javascript to dynamically create
raido buttons. I am able to create them easily enough but they aren't
clickable. It doesn't matter if I set them as checked or not, you can't
manipulate them at all. The code I'm using appears below:
function test(){
componentMainTa ble = document.getEle mentById("mycom ponent");
componentTable = document.create Element("table" );
componentBody = document.create Element("tbody" );
componentMainTa ble.setAttribut e("width","100" );
//row and table information is created here
row1 = document.create Element("tr");
tab1 = document.create Element("td");
tab1.setAttribu te("width", "33%");
tab1.setAttribu te("align", "center");
field1 = document.create Element("input" );
field1.setAttri bute("type","ra dio");
field1.setAttri bute("name","on e");
field1.setAttri bute("value", 1);
tab2 = document.create Element("td");
tab2.setAttribu te("width", "33%");
tab2.setAttribu te("align", "center");
field2 = document.create Element("input" );
field2.setAttri bute("type","ra dio");
field2.setAttri bute("name","on e");
field2.setAttri bute("value",2) ;
tab1.appendChil d(field1);
tab2.appendChil d(field2);
row1.appendChil d(tab1);
row1.appendChil d(tab2);
componentBody.a ppendChild(row1 );
componentTable. appendChild(com ponentBody);
componentMainTa ble.appendChild (componentTable );
field1.setAttri bute("checked", "checked");
}
If anyone can shed some light on this for me, I would be tremendously
grateful!
I have looked around for an answer to this question, but haven't found
one as of yet. I'm trying to use javascript to dynamically create
raido buttons. I am able to create them easily enough but they aren't
clickable. It doesn't matter if I set them as checked or not, you can't
manipulate them at all. The code I'm using appears below:
function test(){
componentMainTa ble = document.getEle mentById("mycom ponent");
componentTable = document.create Element("table" );
componentBody = document.create Element("tbody" );
componentMainTa ble.setAttribut e("width","100" );
//row and table information is created here
row1 = document.create Element("tr");
tab1 = document.create Element("td");
tab1.setAttribu te("width", "33%");
tab1.setAttribu te("align", "center");
field1 = document.create Element("input" );
field1.setAttri bute("type","ra dio");
field1.setAttri bute("name","on e");
field1.setAttri bute("value", 1);
tab2 = document.create Element("td");
tab2.setAttribu te("width", "33%");
tab2.setAttribu te("align", "center");
field2 = document.create Element("input" );
field2.setAttri bute("type","ra dio");
field2.setAttri bute("name","on e");
field2.setAttri bute("value",2) ;
tab1.appendChil d(field1);
tab2.appendChil d(field2);
row1.appendChil d(tab1);
row1.appendChil d(tab2);
componentBody.a ppendChild(row1 );
componentTable. appendChild(com ponentBody);
componentMainTa ble.appendChild (componentTable );
field1.setAttri bute("checked", "checked");
}
If anyone can shed some light on this for me, I would be tremendously
grateful!
Comment