checkboxes abd FF

Discussion in 'JavaScript' started by moiseszaragoza, Aug 27, 2009.

  1. #1
    have a simple calculator i made with checkboxes and some Js.

    the problem is that it does not work in FF.

    any idea how this can work for
    IE
    Safari
    AND FF


    
    
    function getPrice(amount, boxName){
    		total = eval() ;
    	
    		checked = document.getElementById(boxName).checked
    			if (checked){
    				total =  parseFloat(form1.Total2.value) + parseFloat(amount);
    
    			}else{
    				total =  parseFloat(form1.Total2.value) - parseFloat(amount);
    
    			}
    			total.toFixed(2);
    		form1.Total2.value = total
    		document.getElementById("total").innerHTML = "Total $"+total;
    	}
    
    
    Code (markup):

     
    moiseszaragoza, Aug 27, 2009 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    yes, by not using references like this:

    form1.Total2.value

    assign an id to Total2 and then get the value by document.getElementById("Total2").value instead.
     
    dimitar christoff, Aug 27, 2009 IP