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
    Apr 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with supply of code needed

    Hi All first post here so be gentle.

    I'm looking for someone to help supply some code for me to drop into our site. Just needing a basic height x width calculator for them to input various sizes in Millimimetres to get square metre size which I can then apply to around about 14 products which have variable pricing per square metres prices.

    Can anyone help?

    Thanks

  • #2
    Regular Coder Nerevarine's Avatar
    Join Date
    Jan 2013
    Location
    Phendrana Drifts, Tallon IV, W-Class
    Posts
    285
    Thanks
    0
    Thanked 17 Times in 17 Posts
    1000 Millimetres = 100 Centimetres = 1 Metre.

    Are you talking about a built in calculator to calculate on the fly a price?
    Time kills us in our sleep and we watch it happen in our dreams. -K.K.
    THE END-ALL PROGRAMMING REFERENCE: CLICK HERE (Courtesy of Major Payne)
    My username was previously L0adOpt1c. :: Please read this before posting in the HTML/CSS forum.
    Validate your HTML here and your CSS here. :: Need basic HTML/CSS tutorials? Click here, don't post about it.

  • #3
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,609
    Thanks
    24
    Thanked 647 Times in 646 Posts
    This should calculate what you want with some checks.
    Code:
    <!doctype html>
    <html>
    <head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script>
    function limiter(num, diam){
    	var n = num.charAt(num.length-1);
    	if(isNaN(n) == true){
    		num = num.substring(0,num.length - 1);
    		document.getElementById(diam).value = num;
    	}
    	var area = document.getElementById("width").value * document.getElementById("length").value;
    	document.getElementById('total').value = area;
    }
    </script>
    </head>
    <body>
    Witdh  :  <input type="text" id="width" maxlength="4" size="4" onkeyup="limiter(this.value, 'width');">Enter witdh in mm.<br><br>
    Length : <input type="text" id="length" maxlength="4" size="4" onkeyup="limiter(this.value, 'length');">Enter lentgh in mm.<br><br>
    Area   : <input type="text" id="total" maxlength="8" size="8" readonly> Sq. mm.
    </body>
    </html>
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."


  •  

    Posting Permissions

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