pinkshiro
07-07-2008, 01:09 AM
Hello World! I has problem :/
I'm adding a set of radio buttons onto the stage, and applying the name of each input in two different ways - one for IE, and one for everything else :) See below:
if(isIE){//IE workaround
lastName_Input0=document.createElement('<input name="p2_4_migrating'+total+'[]>');
lastName_Input0.type = "radio";
lastName_Input0.value = "defaultRadioButton";
lastName_Input0.style.display = "none";
lastName_Input0.checked = true;
lastName_Input0.id = inputID1;
lastName_Input=document.createElement('<input name="p2_4_migrating'+total+'[]>');
lastName_Input.type = "radio";
lastName_Input.value = "Yes";
lastName_Input.id = inputID2;
lastName_Input1=document.createElement('<input name="p2_4_migrating'+total+'[]>');
lastName_Input1.type = "radio";
lastName_Input1.value = "No";
lastName_Input1.id = inputID3;
lastName_Input1.checked = true;
} else {
var lastName_Input0 = document.createElement('input');
lastName_Input0.type = "radio";
lastName_Input0.checked = true;
lastName_Input0.name = "p2_4_migrating"+total+"[]";
lastName_Input0.value = "defaultRadioButton";
lastName_Input0.style.display = "none";
lastName_Input0.id = inputID1;
var lastName_Input = document.createElement('input');
lastName_Input.type = "radio";
lastName_Input.name = "p2_4_migrating"+total+"[]";
lastName_Input.value = "Yes";
lastName_Input.id = inputID2;
var lastName_Input1 = document.createElement('input');
lastName_Input1.type = "radio";
lastName_Input1.name = "p2_4_migrating"+total+"[]";
lastName_Input1.value = "No";
lastName_Input1.id = inputID3;
}
The problem comes when I want to access one of the input boxes added with the code above, and change the name of the input boxes. In Firefox I can just use inputElement.name = "new name";. As you may know, this isn't recognised in IE. How do I change the name of added input code if they already exist on the stage which works with internet explorer?
Do I need to delete the existing ones and replace them with new radio fields with the new names??? Sounds like I could run into issues here, because what if a radio button has already been checked. I would need to keep a record of whether it was checked. Sounds like a lot of work when all I want to do is update their names!
I'm adding a set of radio buttons onto the stage, and applying the name of each input in two different ways - one for IE, and one for everything else :) See below:
if(isIE){//IE workaround
lastName_Input0=document.createElement('<input name="p2_4_migrating'+total+'[]>');
lastName_Input0.type = "radio";
lastName_Input0.value = "defaultRadioButton";
lastName_Input0.style.display = "none";
lastName_Input0.checked = true;
lastName_Input0.id = inputID1;
lastName_Input=document.createElement('<input name="p2_4_migrating'+total+'[]>');
lastName_Input.type = "radio";
lastName_Input.value = "Yes";
lastName_Input.id = inputID2;
lastName_Input1=document.createElement('<input name="p2_4_migrating'+total+'[]>');
lastName_Input1.type = "radio";
lastName_Input1.value = "No";
lastName_Input1.id = inputID3;
lastName_Input1.checked = true;
} else {
var lastName_Input0 = document.createElement('input');
lastName_Input0.type = "radio";
lastName_Input0.checked = true;
lastName_Input0.name = "p2_4_migrating"+total+"[]";
lastName_Input0.value = "defaultRadioButton";
lastName_Input0.style.display = "none";
lastName_Input0.id = inputID1;
var lastName_Input = document.createElement('input');
lastName_Input.type = "radio";
lastName_Input.name = "p2_4_migrating"+total+"[]";
lastName_Input.value = "Yes";
lastName_Input.id = inputID2;
var lastName_Input1 = document.createElement('input');
lastName_Input1.type = "radio";
lastName_Input1.name = "p2_4_migrating"+total+"[]";
lastName_Input1.value = "No";
lastName_Input1.id = inputID3;
}
The problem comes when I want to access one of the input boxes added with the code above, and change the name of the input boxes. In Firefox I can just use inputElement.name = "new name";. As you may know, this isn't recognised in IE. How do I change the name of added input code if they already exist on the stage which works with internet explorer?
Do I need to delete the existing ones and replace them with new radio fields with the new names??? Sounds like I could run into issues here, because what if a radio button has already been checked. I would need to keep a record of whether it was checked. Sounds like a lot of work when all I want to do is update their names!