Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
IE Drop Down Menu Values are missing
Old 02-26-2009, 09:30 PM IE Drop Down Menu Values are missing
Junior Talker

Posts: 2
Trades: 0
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 = "<font size=2> ft-inch(es) &nbsp; &nbsp; </font>";

            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 = "<input type=\"text\" name=\"height_meters\" size=9 value=\"${selectMtrs}\"><font size=2> m </font>";
            hghtDiv.appendChild(mtrDiv);
        }
    }
JSP SRC
Code:
<td align="right"><font size=2> Height: </font> </td>
<td ><div id="hghtDiv"></div></td>
<td>
    <input type="radio" name="height_unit"
        c:if test="${ (null eq height_unit) or func:equals( 'ft-in', height_unit ) }">
            checked
        </c:if> 
        value="ft-in"
            onClick="addHeightLbl( true );"
    >
    <font size=2>ft-in</font>&nbsp;
</td>

<td>
    <input type="radio" name="height_unit" 
        c:if test="${ not (null eq height_unit) and func:equals( 'meter/s', height_unit ) }">
            checked
        </c:if>
        
                 value="meter/s" onClick="addHeightLbl( false );" 
        >
                        
    <font size=2>m</font>&nbsp;
</td>
here is the form:

FF Snapshots:




IE Snapshot:
blueRainier is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-26-2009, 11:36 PM Re: IE Drop Down Menu Values are missing
Junior Talker

Posts: 2
Trades: 0
problem solved!

replace this:

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

Code:
for(var i=3; 7>=i; i++){
    var optionFt = document.createElement("option");
    optionValues = document.createTextNode(i);
    optionFt.appendChild(optionValues);
    select.appendChild(optionFt);
}
blueRainier is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to IE Drop Down Menu Values are missing
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09792 seconds with 12 queries