E-commerceapplication for pricing by area

  geoff47 20:55 30 Aug 10

I wonder if it possible to have an application to price a commodity by area ?
My idea would be the customer puts in two dimensions and it results in a price based on a price per square metre.
I could give fixed prices for fixed sizes, but would like another option so customers can choose exactly what size they buy.

Hope it's not a tall order.
Any suggestions would be very welcome.
Thanks in advance

  Ansolan 22:13 30 Aug 10

Have the code below lying around if that helps. A bit basic but gives you a start. Doubtless mentioning what you already know but in case, save the code in notepad, change the extension to .html and have a look, see if you think this is worth incorporating into your page. You would only need to change the value (currently 300) and add a little styling to suit.

<script type="text/javascript">
function cal() {
var x=document.form.length.value
var y=document.form.width.value
var a=x*y //calculates square meters
var total=a*300 //calculates cost. Enter your own cost/sq. meter

<h3>Project cost calculator:</h3>
<form action="" name="form">
<p><input type="text" name="length" size="2" /> Enter the length of your project in meters.<br />
<input type="text" name="width" size="2" /> Enter the width of your project in meters.</p>

<p><b>Click this button to calculate the approximate cost of your project:</b><br />
<input type="button" name="money" value="calculate" onclick="cal()" /></p>

<p>£ <input type="text" name="total" size="6" /></p>

  geoff47 23:21 30 Aug 10

Thank you for that, I shall give it a go.
I know next to nothing about code, but have been surprising myself lately.
Done things I thought were beyond me.
Thanks I shall let you know how I get on.
Don't hold your breathe.....this may take a while.

  geoff47 23:31 30 Aug 10

I cannot thank you enough.
Hopefully I can tweak it about a bit to do exactly what I want.
Linking it to a shopping cart.
Many thanks indeed

This thread is now locked and can not be replied to.

Surface Pro (2017) vs Surface Pro 4

Where HTML5 is headed next

MacBook Pro v Surface Pro 5