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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Very Basic Script not working in ie

    Hello,

    Im new to scripting. I have 2 scripts that work in firefox but not in ie. I was wondering if anyone could help me?

    The First Javascript
    Code:
    <SCRIPT language="javascript">
    <!-- // ***** GET TOTAL
    
    function CalculateSum(setup, month, plan, form)
    {
    var A = parseFloat(setup);
    var B = parseFloat(month);
    
    form.x_amount.value = A + B;
    form.user5.value = plan;
    }
    -->
    </SCRIPT>
    The second javascript
    Code:
    	var os_price = 0;
    	var base_price = 0000;
            var total_carryover = 0000;
    
    function show_price() {
    
    	features = 0;
    	for(var pr in price) {
    		features+=price[pr];
    		
    	}
    	
    	month = features + base_price + os_price ;
    	total = month + total_carryover;
    
    	
    	document.getElementById('setup_price').innerHTML="$"+(setup)/100;
    	document.getElementById('monthly_price').innerHTML="$"+(month)/100;
    	document.getElementById('total_price').innerHTML="$"+((total)/100+setup/100);
    	
    
    }
    Thanks in advance for any help.

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,146
    Thanks
    39
    Thanked 505 Times in 499 Posts
    Post the entire HTML and JS.
    Not enough code to determine where the problem might be a this time.
    What form of <!DOCTYPE...> are you using?

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts
    The javascripts that are posted are the full javascripts.

    The <!DOCTYPE...> is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">.

    After some investigation, I realized that the problem might be that I call the scripts from clicking in a drop down menu.

    Code:
    <select class="ver12" >
    <option onclick="price[0]=2499;setup=0;show_price();CalculateSum(0, 24.99, 'VPS20', this.form);">VPS20 &nbsp;Setup &nbsp FREE &nbsp; &nbsp; Monthly &nbsp $24.99</option>
    <option onclick="price[0]=3499;setup=0;show_price();CalculateSum(0, 34.99, 'VPS30', this.form);">VPS30 &nbsp;Setup &nbsp FREE &nbsp; &nbsp; Monthly &nbsp $34.99</option>
    <option onclick="price[0]=4499;setup=0;show_price();CalculateSum(0, 44.99, 'VPS40', this.form);">VPS40 &nbsp;Setup &nbsp FREE &nbsp; &nbsp; Monthly &nbsp $44.99</option>
    <option onclick="price[0]=5499;setup=0;show_price();CalculateSum(0, 54.99, 'VPS50', this.form);">VPS50 &nbsp;Setup &nbsp FREE &nbsp; &nbsp; Monthly &nbsp $54.99</option>
    <option onclick="price[0]=6499;setup=0;show_price();CalculateSum(0, 64.99, 'VPS60', this.form);">VPS60 &nbsp;Setup &nbsp FREE &nbsp; &nbsp; Monthly &nbsp $64.99</option>
    <option onclick="price[0]=8499;setup=0;show_price();CalculateSum(0, 84.99, 'VPS80', this.form);">VPS80 &nbsp;Setup &nbsp FREE &nbsp; &nbsp; Monthly &nbsp $84.99</option>
    </select>
    I had another page that was using the same scripts but was using radio buttons to call the scripts and it work fine.

    I think that the drop down menu is messing it up.

  • #4
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,146
    Thanks
    39
    Thanked 505 Times in 499 Posts

    Lightbulb

    Options don't allow events.
    Try this:
    Code:
    <select class="ver12" onchange="DoYourThing(this.form,this.value)">
    <option value="2499:VPS20">VPS20 Setup FREE Monthly $24.99</option>
    <option value="3499:VPS30">VPS30 Setup FREE Monthly $34.99</option>
    <!-- rest of your options -->
    </select>
    Add some JS to do your thing:
    Code:
    function DoYourThing(f,v) {
      price[0] = v;
      setup = 0;
      var tmp = v.split(':');
      d = Number(tmp[0]/100);
      vp = tmp[1];
      CalculateSum(0,d,vp,f);
    }
    Not tested, but should work better than what you currently have.
    Good Luck!

  • Users who have thanked jmrker for this post:

    jerel4565 (08-16-2009)

  • #5
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts
    IT WORKED!!!

    Thank you so much for your help. I was literally pulling my hair out.

    Thanks again.

  • #6
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,146
    Thanks
    39
    Thanked 505 Times in 499 Posts
    You're most welcome.
    Glad I could help.
    Good Luck!


  •  

    Posting Permissions

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