IE Dropdown Values are missing

this is the assumptions:

- 1 input box for height values, 2 radio buttons for meters and feet inches

- if feet inches radio button is enabled the input box will be removed then a 2 drop down menu will be displayed for a feet inches values and vice versa

the problem is this:
- the code below is working in FF, but in IE the values in the drop down is missing..

what is the problem in my code? did i forgot something?

JAVA SCRIPT SRC
[CODE]

function addHeightLbl( flag ){
var hghtDiv = document.getElementById( "hghtDiv" );
var ftIncDivChck = document.getElementById("ftInc");
var mtrDivChck = document.getElementById("meters");

if ( ftIncDivChck == null && flag == true ){
//remove meters label
if( hghtDiv.firstChild )
hghtDiv.removeChild(hghtDiv.firstChild)

var ftIncDiv = document.createElement( "ftIncDiv" );
var select = document.createElement("select");
select.name = "height_ft";

for(var i=3; 7>=i; i++){
var optionFt = document.createElement("option");
optionFt.name = "optionFt";
optionFt.value = i;
optionFt.text = i + "'";
select.appendChild(optionFt);
}
hghtDiv.appendChild(select);

var selectInch = document.createElement("select");
selectInch.name = "height_inches";

for(var i=0; 11>=i; i++){
var optionInch = document.createElement("option");
optionInch.value = i;
optionInch.text = i + """;
selectInch.appendChild(optionInch);
}
hghtDiv.appendChild(selectInch);

ftIncDiv.setAttribute("id", "ftInc");
ftIncDiv.innerHTML = " ft-inch(es)     ";

hghtDiv.appendChild(ftIncDiv);
}


if ( flag == false ){
//remove ft-inches label & downdown
while( hghtDiv.firstChild ){
hghtDiv.removeChild(hghtDiv.firstChild);
}

var mtrDiv = document.createElement( "mtrDiv" );
mtrDiv.setAttribute("id", "meters");
mtrDiv.innerHTML = " m ";
hghtDiv.appendChild(mtrDiv);
}
}
[/CODE]

JSP SRC
[CODE]
Height:



checked

value="ft-in"
onClick="addHeightLbl( true );"
>
ft-in 




checked


value="meter/s" onClick="addHeightLbl( false );"
>

m 

[/CODE]

here is the form:


FF Snapshots:
[img=http://img291.imageshack.us/img291/7484/bmi.png]

[img=http://img99.imageshack.us/img99/3539/bmi2.png]

IE Snapshot:
[img=http://img204.imageshack.us/img204/3302/bmi1.png]

Comments

  • problem solved!

    replace this:

    [CODE]

    for(var i=3; 7>=i; i++){
    var optionFt = document.createElement("option");[B]
    optionFt.name = "optionFt";
    optionFt.value = i;
    optionFt.text = i + "'";[/B]
    select.appendChild(optionFt);
    }

    [/CODE]

    by this:

    [CODE]
    for(var i=3; 7>=i; i++){
    var optionFt = document.createElement("option");
    [B] optionValues = document.createTextNode(i);
    optionFt.appendChild(optionValues);[/B]
    select.appendChild(optionFt);
    }
    [/CODE]

    :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion