...

View Full Version : This script won't work. Online price quoting.



jackaroo400
05-31-2009, 05:17 AM
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.:thumbsup: 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.:eek: Ok, here is the 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! :D

TinyScript
05-31-2009, 07:03 AM
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




<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>

jackaroo400
05-31-2009, 07:18 AM
Hey,

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

Thanks

Philip M
05-31-2009, 08:22 AM
Hey,

That's great :thumbsup: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)

effpeetee
05-31-2009, 12:31 PM
“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

Philip M
05-31-2009, 03:17 PM
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. :D:D And you are clearly young at heart. :D:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum