Problem with JS and internet explorer

Discussion in 'JavaScript' started by kinggomez, May 2, 2011.

  1. #1
    I have a piece of javascript that works perfectly in al other browers, including mobile...except internet explorer.

    This is the code causing me trouble:
    function calcQuote (form) {
    	var fromengv = form.fromeng.value;
    	var toengv = form.toeng.value;
    	var nowords = form.nowords.value;
    	var sector = form.sector.value;
    	var type = form.type.value;
    	var trans = form.trans.checked;
    	var proof = form.proof.checked;
    		
    	if (fromengv == "None" && toengv == "None") {
    		alert('No language selected!');
    	} else if (fromengv !== "None" && toengv !== "None") {
    		alert('Please select one language combination only!');
    	} else if (fromengv !== "None" && toengv == "None") {
              .......
              }
    Code (markup):
    Values are taken from a form on submission and check them with the code above. In IE it is returning the error message "Please select one language combination only" under every condition, ie, both are none, one is none, none are none.

    What could be causing this?
     
    kinggomez, May 2, 2011 IP
  2. Jan Novak

    Jan Novak Peon

    Messages:
    121
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Please could you post URL where this happens?
     
    Jan Novak, May 2, 2011 IP
  3. kinggomez

    kinggomez Active Member

    Messages:
    268
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Problem solved - it was a blatent schoolboy error.

    The values in question were coming from a <option> field, I forgot to add the value="" into it, all other browsers take the value between the <option></option> if a set value is not set.
     
    Last edited: May 3, 2011
    kinggomez, May 3, 2011 IP