www.webdeveloper.com
Results 1 to 2 of 2

Thread: Javascript Drop Down Menu Same as not working in IE

  1. #1
    Join Date
    Mar 2014
    Posts
    1

    Javascript Drop Down Menu Same as not working in IE

    I am struggling a little with a form with drop down menus for billing and shipping states. I have a Same as Shipping Address button. All fields expect the billing state drop down auto fill when clicked in IE. It works as planned in Firefox and Chrome, but does not work in any version of IE. It simply changes the value to blank. Any help is greatly appreciated.

    The Javascript:
    Code:
    <script type="text/javascript">
    // <!--
    function billsame(form){
    
    if(form.sameasshipping.checked){
    	
         form.name.value = form.nametoship.value;
         form.address.value = form.addresstoship.value;
         form.city.value = form.citytoship.value;  
         form.zip.value = form.ziptoship.value;
        document.getElementById('state').value = document.getElementById('statetoship').value; 
    
    }
    else{
         form.name.value = "";
         form.address.value = "";
         form.city.value = "";  
         form.zip.value = "";
         form.state.value = "";
    }
    }
    //-->
    </script>
    The Same As Button:
    Code:
    <input type="checkbox" name="sameasshipping" value="checkbox" onClick="billsame(this.form);">Same as Shipping Address
    The Drop Down Menus:
    Code:
    	
     	 	echo "State&nbsp;&nbsp;&nbsp;&nbsp;\n";
        echo "<select name=\"statetoshipdrop\" id=\"statetoship\" disabled>";  
           echo '<option selected="">Select Your State</option>';  
           $statesa = statesList();  
            foreach($statesa as $keya=>$valuea) {  
            	if ($keya==$statetoship) {
            		$selecteda=" selected=\"selected\" ";
    				} else {
    					$selecteda="";
    	}
    	echo "<option $selecteda>$keya</option>";
            }  
       echo '</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>';  
    
    	}
    
     	echo "State&nbsp;&nbsp;&nbsp;&nbsp;\n";
        echo '<select name="state" id="state">';  
            echo '<option value="">Select Your State</option>';  
           
            $statesb = statesList();  
            foreach($statesb as $keyb=>$valueb) {  
            	if ($keyb==$state) {
            		echo "<option selected=\"selected\" value=\"$keyb\">$keyb</option>";
      
    				} else {
    				echo "<option value=\"$keyb\">$keyb</option>";
            }  
            }
        echo "</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>";  
    
    	}
    Thank You

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,672
    why not post HTML instead of this php code?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles