Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IE Drop Down Menu 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 = "<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:
    Last edited by blueRain; 02-26-2009 at 10:58 AM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,866
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Could you post your html as well, so that we will be able to execute the script at our end, or a link would be better!
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sure sure..

    ill update the code asap..

    Quote Originally Posted by abduraooft View Post
    Could you post your html as well, so that we will be able to execute the script at our end, or a link would be better!
    Last edited by blueRain; 02-26-2009 at 10:53 AM.

  • #4
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool

    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);
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •