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
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy This script won't work. Online price quoting.

    Ok, I am writing an Online price quoting script for Sydney logistics a storage company. I've written this and the interface looks good so far. But i need it to calculate the cost of the storage they want. they input how many and for how long they want storage for four different pallet types and i want the price to appear in the text box down the bottom. Ok, here is the code:

    Code:
    <html>
    
    <head>
    <title>Sydney Logistics</title>
    
    <script LANGUAGE = "Javascript">
    <!--
    function Calculate() 
    	{
    		var Number = (Form1.Textbox1.value);
    		//calculates the value of reg pallets
    		if (Number <20 ) 
    			{
    				alert (Form1.Textbox1.value * 5.00 );
    			}
    		else if (Number <50) 
    			{
    				alert (Form1.Textbox1.value * 4.85 );
    			}
    		else if (Number <150) 
    			{
    				alert (Form1.Textbox1.value * 4.60 );
    			}
    		else if (Number >150) 
    			{
    				alert ("Please Call us for a quote for orders over 150 pallets");
    			}
    		var Number = (Form1.Textbox1.value);
    		if (Number <20 ) 
    			{
    		alert ( "$" + Form1.Textbox2.value * Form1.Textbox1.value );
    			}
    				alert (Form1.Textbox1.value * 5.0 );
    			}
    		var Number = (Form1.Textbox3.value);
    		//calculates the value of oversized pallets
    		if (Number >0 ) 
    			{
    				alert (Form1.Textbox3.value * Form1.Textbox4.value * 10.0 );
    			}
    		var Number = (Form1.Textbox5.value);
    		//calculates the value of overweight pallets
    		if (Number >0 ) 
    			{
    				alert (Form1.Textbox5.value * Form1.Textbox6.value * 13.5 );
    			}
    		var Number = (Form1.Textbox7.value);
    		//calculates the value of climate controlled pallets
    		if (Number >0 ) 
    			{
    				alert (Form1.Textbox7.value * Form1.Textbox8.value * 21.5);
    			}
    	}
    
    	//-->
    </script>
    	</head>
    		<body>
    
    	<form name="Form1">
    
    <h2><em>Welcome to Sydney Logistics Quick Quoting System. </em></h2>
    <p>Please complete all information below for a quote.</p>
    <p><strong>Regular Pallets:</strong></p>
    <p>Please enter the quantity wanted   
    	<input type ="text" name="Textbox1"></p>
    <p>Please enter the amount of time storage is required (weeks)
    	<input type ="text" name="Textbox2"> </p>
    <p><strong>Oversized Pallets (Exceeding 1200mm x 1200mm x 1200mm)</strong>:</p>
    <p>Please enter the quantity wanted 
        <label>
    	<input type="text" name="Textbox3" id="Textbox3">
        </label>
    <p>Please enter the amount of time storage is required (weeks) 
        <label>
    	<input type="text" name="Textbox4" id="Textbox4">
        </label>
    <p><strong>Overweight Pallets (Greater than 750kg)</strong>:</p>
    <p>Please enter the quantity wanted 
        <label>
    	<input type="text" name="textbox5" id="textbox5">
        </label>
    <p>Please enter the amount of time storage is required (weeks) 
        <label>
    		
    	<input type="text" name="textbox6" id="textbox6">
        </label>
    <p><strong>Climate Controlled Pallets (Refrigerated, humidity, etc):</strong></p>
    <p>Please enter the quantity wanted 
        <label>
    	<input type="text" name="textbox7" id="textbox7">
        </label>
    <p>Please enter the amount of time storage is required (weeks) 
        <label>
    	<input type="text" name="textbox8" id="textbox8">
        </label>
    <p>
    	<input type="button" value="Go" onClick="Calculate()">
    		
        	<input type="Reset" value="Clear" >
    <p>Your quote comes to: 
    	<input type="text" value="$0" name="txtOutput" />
    <input type="button" value="Print this Quote" onClick="window.print()">
    		
    </p>
    
    <strong>To order please call us or drop in to our warehouse.</strong>:</p>
    <p>Sydney Logistics.</p>
    <p>26 Parramatta Road</p>
    <p>Parramatta</p>
    <p></p>
    <strong>Phone: </strong>99876658</p>
    <strong>Fax: </strong>99876659</p>
    
    </form>
    </body>
    </html>


    Ok, so for each of the pallets here is the pricing:

    Regular Pallets: ($5 for quantity of <20, $4.85 for 20-50, $4.60 for 50-150, and 150+ Please call for a quote
    Oversized pallets: $10 per week
    Overweight pallets: $13.50 per week
    Climate Controlled Pallets: $21.50 per week

    If you could help me in any way it would be great! THANKS!
    Last edited by Kor; 05-31-2009 at 05:39 AM. Reason: use [/code] to close the code tag

  • #2
    Regular Coder
    Join Date
    Mar 2009
    Location
    Portland Oregon
    Posts
    690
    Thanks
    44
    Thanked 63 Times in 62 Posts
    I'm not sure of the exact deatils of the script and I changed a few things, but hopefully you will be able to use this and fix what I screwed up. I think i erased something you wanted to save, but you should be able to see what's going on.
    Form1[8] and Form1[9] are the buttons above the textoutput

    Code:
    <html>
    
    <head>
    <title>Sydney Logistics</title>
    
    <script LANGUAGE = "Javascript">
    <!--
    function Calculate() 
    	{
    var Form1=document.getElementById("Form1")
    //calculates the value of reg pallets
    		
    if (0<Form1[0].value <20 ) {alert (Form1[0].value * 5.00 );Form1[10].value=Form1[0].value*5}
    		
    else 
    if (20< Form1[0].value <50) {alert (Form1[0].value * 4.85 );Form1[10].value=Form1[0].value*4.85}
    		
    else 
    if (50< Form1[0].value <150) {alert (Form1[0].value * 4.60 );Form1[10].value=Form1[0].value*4.6}
    		
    else 
    if (Form1[0].value >150){alert ("Please Call us for a quote for orders over 150 pallets")}
    		
    if (0<Form1[1].value <20 ) {alert ( "$" + Form1[1].value * Form1[0].value );Form1[10].value=Form1[1].value * Form1[0].value }
    		
    		//calculates the value of oversized pallets
    if (Form1[2].value >0 ){alert (Form1[2].value * Form1[3].value * 10.0 );Form1[10].value=Form1[2].value * Form1[3].value}
    		
    		//calculates the value of overweight pallets
    		
    if (Form1[4].value >0 ){alert (Form1[4].value * Form1[5].value * 13.5 );Form1[10].value=Form1[4].value * Form1[5].value * 13.5 }
    		
    		//calculates the value of climate controlled pallets
    		
    if (Form1[6].value >0 ){alert (Form1[6].value * Form1[7].value* 21.5);Form1[10].value=Form1[6].value * Form1[7].value* 21.5}
    
    	}
    
    	//-->
    </script>
    	</head>
    		<body>
    
    	<form id="Form1">
    
    <h2><em>Welcome to Sydney Logistics Quick Quoting System. </em></h2>
    <p>Please complete all information below for a quote.</p>
    <p><strong>Regular Pallets:</strong></p>
    <p>Please enter the quantity wanted   
    	<input type ="text" name="Textbox1"></p>
    <p>Please enter the amount of time storage is required (weeks)
    	<input type ="text" name="Textbox2"> </p>
    <p><strong>Oversized Pallets (Exceeding 1200mm x 1200mm x 1200mm)</strong>:</p>
    <p>Please enter the quantity wanted 
        <label>
    	<input type="text" name="Textbox3" id="Textbox3">
        </label>
    <p>Please enter the amount of time storage is required (weeks) 
        <label>
    	<input type="text" name="Textbox4" id="Textbox4">
        </label>
    <p><strong>Overweight Pallets (Greater than 750kg)</strong>:</p>
    <p>Please enter the quantity wanted 
        <label>
    	<input type="text" name="textbox5" id="textbox5">
        </label>
    <p>Please enter the amount of time storage is required (weeks) 
        <label>
    		
    	<input type="text" name="textbox6" id="textbox6">
        </label>
    <p><strong>Climate Controlled Pallets (Refrigerated, humidity, etc):</strong></p>
    <p>Please enter the quantity wanted 
        <label>
    	<input type="text" name="textbox7" id="textbox7">
        </label>
    <p>Please enter the amount of time storage is required (weeks) 
        <label>
    	<input type="text" name="textbox8" id="textbox8">
        </label>
    <p>
    	<input type="button" value="Go" onclick="Calculate(this.value)">
    		
        	<input type="Reset" value="Clear" >
    <p>Your quote comes to: 
    	<input type="text" value="$0" name="txtOutput" />
    <input type="button" value="Print this Quote" onClick="window.print()">
    		
    </p>
    
    <strong>To order please call us or drop in to our warehouse.</strong>:</p>
    <p>Sydney Logistics.</p>
    <p>26 Parramatta Road</p>
    <p>Parramatta</p>
    <p></p>
    <strong>Phone: </strong>99876658</p>
    <strong>Fax: </strong>99876659</p>
    
    </form>
    </body>
    </html>

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey,

    That's great but i want it to add up all the prices and write them in the text box that says "Your quote comes to"

    Thanks

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Quote Originally Posted by jackaroo400 View Post
    Hey,

    That's great but i want it to add up all the prices and write them in the text box that says "Your quote comes to"

    Thanks
    Well, that is exactly what it does. The intermediate alerts are only for testing purposes.

    <script LANGUAGE = "Javascript"> is long deprecated and obsolete. Use <script type = "text/javascript"> instead. The <!-- and //--> hiding tags have been obsolete sibce IE4.


    “The old believe everything; the middle aged suspect everything; the young know everything.” - Oscar Wilde (Irish Poet, Novelist, Dramatist and Critic, 1854-1900)

  • #5
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    “The old believe everything; the middle aged suspect everything; the young know everything.” - Oscar Wilde (Irish Poet, Novelist, Dramatist and Critic, 1854-1900)
    That's the daftest thing I've read to date. I am 84yrs old in Sept. and I believe nothing unless I can confirm it. Most of my associates are the same. Old age very often breeds cynicism. Most of us have heard it all before.

    Frank
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Quote Originally Posted by effpeetee View Post
    That's the daftest thing I've read to date. I am 84yrs old in Sept. and I believe nothing unless I can confirm it. Most of my associates are the same. Old age very often breeds cynicism. Most of us have heard it all before.

    Frank
    Ah yes, but these days 84 counts as middle aged. And you are clearly young at heart.


  •  

    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
    •