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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calulating Square Feet?

    Trying to calulate square feet?

    Example:

    12 Feet Wide * 20 Feet Length = 240 square feet

    how would i script this?

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just like that!

    The real questions you should be asking yourself is:
    -Where are you getting the width and length from?
    -Where do you plan on storing the result (square footage)?

    Figure that out and maybe we can further help you.

    Sadiq.

  • #3
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Somthing like this?

    Code:
    <html>
    <head>
    <script type="text/javascript">
    
    function calcSqFeet()
    {
    	var x=document.getElementById('wdt').value;
    	var y=document.getElementById('hgt').value;
    	var sqfeet=x*y;
    	alert('The area is '+x+' X '+y+'. Which is '+sqfeet+' sqft.');
    }
    
    </script>
    </head>
    <body>
    <form id="f1" onsubmit="calcSqFeet()">
    Width:<input type="text" id="wdt">
    Height:<input type="text" id="hgt">
    <input type="submit" value="Calculate">
    </form>
    </body>
    </html>
    Hope That Helps,
    Basscyst
    Helping to build a bigger box. - Adam Matthews


  •  

    Posting Permissions

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