Anyone know where i could find this?

I need a script where you enter a number in a text field and it and it will take off 50 percent of that number.

Also, i need a script where you enter a number for example 500 sq ft and spit out a number based on a how much we charge for per square foot.

ok, well ?

google.com

but srsly… write a javascript function.

google.com

but srsly… write a javascript function.

I can’t write javascript from scratch.

Thank you, How would I be able to make it so I would set the cost per foot, and the user would just have the text field to enter their square footage

where it says var charge = something;

change it to a number instead of something

Why do you need a ‘script’ to do this? Can you elaborate how you will be using this?

You could do this in a minute via Excel in 30 seconds – if you are using this to populate some random html page, you can always export the Excel data in .html or via XML.

I can’t write javascript from scratch.

Thank you, How would I be able to make it so I would set the cost per foot, and the user would just have the text field to enter their square footage

If you want to use that script you need to add jquery to your page too. You can use the google CDN

<script  src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>

Why do you need a ‘script’ to do this? Can you elaborate how you will be using this?

You could do this in a minute via Excel in 30 seconds – if you are using this to populate some random html page, you can always export the Excel data in .html or via XML.

Its just for a roofing site im doing. I want the customer to be able to goto the site and get a rough estimate on how much we charge compared to getting a complete re-roof. So their would be a text field to enter their sq ft of their roof and it would spit out a price we would charge.

its not working

Your script is being executed before the submit input is on the page. So just have it execute after the page has been loaded, something like this:

    $(window).load(function(){
        $('#submit-square').click(function(){
            var charge = parseFloat($('#charge').val());
            var numFeet = parseFloat($('#numfeet').val());
            $('#cost').text(charge*numFeet);
        });
    });

Use this:

$(document).ready(function(){
    $('#submit-square').click(function(){
        var charge = parseFloat($('#charge').val());
        var numFeet = parseFloat($('#numfeet').val());
        $('#cost').text(charge*numFeet);
    });
});