javascript - Price calculator (quote) based on word count -
i working on ad form local newspaper. not familiar programming side of things, still learning. able form count words, need quote price based on different packages/ word counts. here example of form , price structure example is. appreciated point me in right direction! please nice, practice/learning me!!
one paper $6.50 15 words, 10 cents per word thereafter. 2 papers $12.50 15 words 15 cents per word thereafter. 3 papers $18.00 15 words 15 cents per word thereafter. 4 papers $22.50 15 words 15 cents per word thereafter.
<!doctype html> <html> <head> <meta charset="utf-8"> <title>place ad</title> <link href="adform.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="js/jquery-1.10.2.js"></script> <script type="text/javascript"> counter = function() { var value = $('#text').val(); if (value.length == 0) { $('#wordcount').html(0); return; } var regex = /\s+/gi; var wordcount = value.trim().replace(regex, ' ').split(' ').length; $('#wordcount').html(wordcount); }; $(document).ready(function() { $('#count').click(counter); $('#text').change(counter); $('#text').keydown(counter); $('#text').keypress(counter); $('#text').keyup(counter); $('#text').blur(counter); $('#text').focus(counter); }); </script> </head> <body id="container"> <form> <p>first name <br> <input type="text"> </p> last name <br> <input type="text"> <p> billing address: <br> <input type="text"> </p> <p> <input type="text"> </p> <p> city: <br> <input type="text"> </p> <p> state: <br> <input type="text"> </p> <p> zip code: <br> <input type="text"> </p> <p> classification: <br> <select> <option>4x4</option> <option>acreage</option> <option>antiques</option> <option>appliances</option> <option>apts duplex rent</option> <option>auctions</option> <option>automobiles</option> <option>boats</option> <option>business sale</option> <option>business opportunity</option> <option>childcare</option> <option>classic vehicles</option> <option>commercial rent</option> <option>commercial sale</option> <option>computers</option> <option>electricians</option> <option>employment</option> </select> </p> <p>ad body: <br> <textarea id="text" cols="50" rows="4"></textarea> <br> <div id="result"> <strong>words: <span id="wordcount">0</span> </strong> <br /> <p>attach photo: <br> <input type="file" name="pic" accept="image/*"> </p> number of weeks: <br> <select> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> <p> extended coverage areas: <br> coverage area 1 <input type="checkbox" name="coverage" value="coverage 1"> <sub>eastern washington including spokane</sub> <br> coverage area 2 <input type="checkbox" name="coverage" value="coverage 2"> <sub>lewiston , moscow areas </sub> <br> coverage area 3 <input type="checkbox" name="coverage" value="coverage 3"> <sub>tricities , surrounding areas </sub> <br> </p> <p>comments: <br> <textarea cols="50" rows="3" id='text'></textarea> </p> <sub>please note: ads without complete billing information or ad text not accepted.</sub> </form> </body> </html>
Comments
Post a Comment