JavaScript - Problems Making Estimate/quote System
It shouldn't be too hard. I just can't crack it. I haven't moved from my computer in hours
So, my problem... In a form I have two drop down menus (list of 3 and 7) and two tick boxs. What I want to do is show an estimated quote based on the selections. Here is the code I have if it helps. I haven't included the javascript in the header since it doesn't make sense. Code: <form method="post" action=""> <div id="left"> <p><b>Name:</b><br /><input type="text" name="name" /></p> <p><b>Daytime Number:</b><br /><input type="text" name="daytime" /></p> <p><b>Address Line 1:</b><br /><input type="text" name="address1" /></p> <p><b>City/Town:</b><br /><input type="text" name="citytown" /></p> <p><b>Postcode:</b><br /><input type="text" name="postcode" /></p> <p><b>Cake Type:</b><br /><select id="caketype"> <option value="0">Fruit cake +£0</option> <option value="20">Sponge +£20</option> <option value="30">Chocolate +£30</option> </select></p> <p><b>Tiers:</b><br /><select name="tiers"> <option>1 Tier +£0</option> <option>2 Tiers +£20</option> <option>3 Tiers +£40</option> <option>4 Tiers +£60</option> <option>5 Tiers +£80</option> <option>6 Tiers +£100</option> </select></p> <p><input type="submit" value="Submit Message"/><input type="reset" /></p> </div> <div id="right"> <p><b>Email:</b><br /><input type="text" name="email" /></p> <p><b>Mobile Number:</b><br /><input type="text" name="mobile" /></p> <p><b>Address Line 2:</b><br /><input type="text" name="address2" /></p> <p><b>County:</b><br /><input type="text" name="county" /></p> <p><b>Message:</b><br /><textarea name="message" cols=30 rows=2></textarea></p> <p><b>Extras:</b><br /> <input type="checkbox" id="selecteddecorativebox" value="25" />Decorative Box +£25<br /> <input type="checkbox" id="selecteddelivery" value="20" checked/>25 Mile Maximum Delivery +£20<br /></p> <h4>Estimated Price: £<script type="text/javascript"> var base = 100; var quote = base + caketype + tiers + decorativebox + delivery; document.write(quote); </script><button type="button" onclick="refresh()">Refresh</button></h4> <div id=output><br /></div> </div> </form> Thanks Similar TutorialsI use Firefox and am wondering how to select a word and wrap [b] tags or [quote] tags around it? Any tutorials?
Hi all. I hope that everyone is fine and doing well. This is something of an annual visit for me. You guys helped me enormously with the code below. It is a price quote generator that takes a number (entered by the client) and depending on the package selected, produces a price quote. As I said, it works really well, but it's time for me to expand my business overseas. At the moment, I display the price as a single currency, but I would like for clients to be able to select (maybe from a drop down list in the answer field) any one of 4 different currencies (i.e., GBP, USD, EURO, MYR). The different exchange rates don't need to be up to the minute accurate. I'm quite happy to go in to the code and update them weekly or as required. I have attempted to research different ways of doing this, but as my needs are quite unusual and my brain really can't wrap around the ins and outs of java script, i'm here again begging with my cap in hand for help. To see this code in action as it stands, please go to www.grammarproofing.com Code: <head> <!--quote generator --> <script type="text/javascript"> function update(){ var price = document.getElementById("Package").value; var words = document.getElementById("words").value; if (words != "") { words = parseInt(words); if (isNaN (words)) { alert ("Please enter the number of words in figures"); document.getElementById("words").value = ""; return false; } } var wordsOver2000 = words-2000; if (wordsOver2000 <0) {wordsOver2000 = 0} words = words - wordsOver2000; var Tprice = ((price * words) + (price * .95 * wordsOver2000)).toFixed(2) ;document.getElementById("Totprice").value = Tprice; document.getElementById("Totprice2").innerHTML = "Your Quote Total Is: MYR" + Tprice } </script> <!--end quote generator --> </head> Code: <body> <!--start quote generator --> <div class="quote" id="quote"> <select name="Package" id = "Package" onchange = "update()"> <option value="0.052">STUDENTS THE 11th HOUR PACKAGE</option> <option value="0.041">STUDENTS EXPRESS PACKAGE</option> <option value="0.035" selected="selected">STUDENTS WORK in PROGRESS PACKAGE</option> </select> x <input type="text" id="words" onchange="update()" value="" /> WORDS<br /> = MYR <input type = "text" id = "Totprice" readonly /> </div> <!--end quote generator --> </body> Thanks in advance for any help offered. Regards as always, Phil Hi All, I need a code for my online blind shop so that customers can get a quote without having to go through the order process. They would need to enter their fabric range, style and width and drop. My first obsticle is where to start learning how to do it! Could anyone please point me in the direction of a good but easy to understand tutorial or advise me on how I can achieve my goal? I've looked all over the internet but cant find what I am looking for. I'm willing to learn and do this myself, otherwise I'll have to pay for someone else to do it for me. Any help would be great! Thanks, Deb. I am trying to create a function or have this work some how where it displays the first number when you make your choice in the first drop down box, which is working so far. In the second drop down box, if any of the answers are chosen except for none, it will take off 10% of the first number. Then add or subtract from there. I just have a problem with creating a function to take off that 10%. Here is the javascript: Code: /* This source is shared under the terms of LGPL 3 www.gnu.org/licenses/lgpl.html You are free to use the code in Commercial or non-commercial projects */ //Set up an associative array //The keys represent the size of the cake //The values represent the cost of the cake i.e A 10" cake cost's $35 var practice_field = new Array(); practice_field["None"]=0; practice_field["Allergy and Immunology"]=4400; practice_field["Endocrinology"]=4400; practice_field["Pathology"]=4400; practice_field["Dermatology"]=4400; practice_field["Geriatrics"]=4400; practice_field["Physical Rehabilitation"]=4400; practice_field["Family Practice"]=6900; practice_field["General Practice"]=6900; practice_field["Internal Medicine"]=6900; practice_field["Oncology"]=6900; practice_field["Oral Surgery"]=6900; practice_field["Radiology"]=6900; practice_field["Gastroenterology"]=6900; practice_field["Infectious Disease"]=6900; practice_field["Nephrology"]=6900; practice_field["Ophthalmology"]=6900; practice_field["Pediatrics"]=6900; practice_field["Urology"]=6900; practice_field["Anesthesiology"]=9000; practice_field["Cosmetic Surgery"]=9000; practice_field["General Surgery"]=9000; practice_field["Neurology"]=9000; practice_field["Otolaryngology"]=9000; practice_field["Plastic Surgery"]=9000; practice_field["Vascular Surgery"]=9000; practice_field["Cardiology"]=9000; practice_field["Emergency Medicine"]=9000; practice_field["Gynecology"]=9000; practice_field["Orthopedic Surgery"]=9000; practice_field["Pain Management"]=9000; practice_field["Pulmonary Surgery"]=9000; practice_field["Neurological Surgery"]=9900; practice_field["Obstetrics"]=9900; //Set up an associative array //The keys represent the filling type //The value represents the cost of the filling i.e. Lemon filling is $5,Dobash filling is $9 //We use this this array when the user selects a filling from the form var society_member= new Array(); society_member["None"]=1; society_member["BCMA"]=0.10; society_member["DCMA"]=0.10; society_member["FOGS"]=0.10; society_member["FNS"]=0.10; society_member["PBCMS"]=0.10; society_member["FSPS"]=0.10; //This function finds the filling price based on the //drop down selection function getPracticeField() { var docPracticeField=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the select id="filling" var selectedPracticeField = theForm.elements["practice"]; //set cakeFilling Price equal to value user chose //For example filling_prices["Lemon".value] would be equal to 5 docPracticeField = practice_field[selectedPracticeField.value]; //finally we return cakeFillingPrice return docPracticeField; } //This function finds the filling price based on the //drop down selection function getSelectedSociety() { var docSelectedSociety=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the select id="filling" var selectedSociety = theForm.elements["society"]; //set cakeFilling Price equal to value user chose //For example filling_prices["Lemon".value] would be equal to 5 docSelectedSociety = society_member[selectedSociety.value]; //finally we return cakeFillingPrice return docSelectedSociety; } //candlesPrice() finds the candles price based on a check box selection function candlesPrice() { var candlePrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["includecandles"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { candlePrice=5; } //finally we return the candlePrice return candlePrice; } function insciptionPrice() { //This local variable will be used to decide whether or not to charge for the inscription //If the user checked the box this value will be 20 //otherwise it will remain at 0 var inscriptionPrice=0; //Get a refernce to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includeinscription" var includeInscription = theForm.elements["includeinscription"]; //If they checked the box set inscriptionPrice to 20 if(includeInscription.checked==true){ inscriptionPrice=20; } //finally we return the inscriptionPrice return inscriptionPrice; } function calculateTotal() { //Here we get the total price by calling our function //Each function returns a number so by calling them we add the values they return together var cakePrice = getPracticeField() * getSelectedSociety() + candlesPrice() + insciptionPrice(); //display the result var divobj = document.getElementById('totalPrice'); divobj.style.display='block'; divobj.innerHTML = "Total Price For the Cake $"+cakePrice; } function hideTotal() { var divobj = document.getElementById('totalPrice'); divobj.style.display='none'; } Hi all again, Firstly thanks to Philip M for getting me this far but i still have a few quirks that i'd like to get around. Its a price generator with 3 options. User selects an option from a drop down, inputs "number of words" and hey-presto the price appears. That works superbly well but what would be really cool is if after someone gets a price they then would like to select a different option in order to see a new price. At the moment it means selecting another option and re-entering the number of words and then clicking in the price box to get the new result. Is there anyway to make that price change automatically (as if by magic even) if either the "option" or "number of words" is changed I have a sneaky suspicion that Philip M will come to the rescue again but should anyone else have a view that would be great also. Thanks as always in advance, Phil Code: <head> <!--quote generator --> <script type="text/javascript"> function update(){ var price = document.getElementById("Package").value; var words = document.getElementById("words").value; var wordsOver2000 = words-2000; if (wordsOver2000 <0) {wordsOver2000 = 0} words = words - wordsOver2000; var Tprice = ((price * words) + (price * .80 * wordsOver2000)).toFixed(2) ;document.getElementById("Totprice").value = Tprice; document.getElementById("Totprice2").innerHTML = "Your Quote Total Is: MYR" + Tprice } </script> <!--end quote generator --> </head> Code: <body> <!--quote generator --> <div align="center" class="generator"> PACKAGE - <select name="Package" id = "Package"> <option value="0.027">Economy</option> <option value="0.038">Standard</option> <option value="0.049">Express</option> </select> No. of Words - <input type="text" id="words" onchange="update()" value="" /> ---> MYR <input type = "text" id = "Totprice" value="...then click here" /><br /> <br /><strong>(NB - To see a quote for a different package, please select package and re-enter the number of words)</strong> </div> <!--end quote generator --> </body> Firstly i have to thank Philip M for this code which is great but for what i need, requires a little extra tweaking. Its a price quote generator (package price x number of pages = price) However if the customer has more pages over a set amount (2000) the package price changes. So the formula becomes (package price x pages (upto 2000) = price + number of pages over 2000 x new package price = Total price. Does that make sense? So i can do a flat rate with this code but if anyone has suggestions on how to do the rest? I would be eternaly grateful as my head really hurts. Code: <head> <script type="text/javascript"> function update(){ var price = document.getElementById("Package").value; var pages = document.getElementById("pages").value; var Tprice = (price * pages).toFixed(2) ; document.getElementById("Totprice").value = Tprice; document.getElementById("Totprice2").innerHTML = "Your Order Total Is: $" + Tprice } </script> </head> <body> choose<select name="Package" id = "Package"> <option value="2">a</option> <option value="3">b</option> <option value="4">c</option> </select> No. of PAGES <input type = "text" id = "pages" onChange="update()" ><br> QUOTE <input type = "text" id = "Totprice"> <br><br> <span id ="Totprice2"></span><br> </body> Thanks all I have to create a website as a project for my university course. Said course has nothing at all to do with computers really so it's really throwing us into the deep end as the majority of us have/had no interest in this particular field. Regardless, I am creating a website that uses the Random Quote Generator Javascript that I copied from the Hotscripts website. The code details are below and my question is: is there any way I could change the formatting for each quote? For example, change quote 1 to be, say, yellow or bold and change quote 3 to be aligned right and blue? I mainly want to change the colour for each quote but having any other info on how to format it would be really helpful. Code: var quotes=new Array(); quotes[0] = "This is quote 1."; quotes[1] = "This is quote 2."; quotes[2] = "This is quote 3."; var q = quotes.length; var whichquote=Math.round(Math.random()*(q-1)); function showquote(){document.write(quotes[whichquote]);} showquote(); Also if you could put it into total idiot-speak for me I'd be oh so grateful. I have the following piece of script to write a line in HTML which is variable; the variable 'bunting' is the path and filename (which varies depending on site where page resides): <CODE> <script language="JavaScript" type="text/javascript"> <!-- document.write('<div id="ic1" style="background-image:url(' + bunting + ');">'); //--> </script> </CODE> This works in most browsers, but in Firefox 3.0.4, it fails to render, and instead generates a piece of literal text: ');//--> on the page. I've read, and re-read the script, and believe it to be correct (with the single quote marks being the javascript delimiters and the double quotes being the html delimiters. I've also tried various combinations of creating piecemeal variables and then creating a final variable by concatenating the pieces. Any help would be greatly appreciated. I have this script and it is performing the calculations to provide an instant price quote script fine in IE and also making only certain boxes editable when a certain radio button is clicked. However in Firefox or Safari it isn't working. Code: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> td.calchead{ width:75px; background:none; border-top:thin solid black; text-align:right; } td.calc{ width:75px; background:none; border:thin solid black; text-align:right; } td.products{ float:right; text-align:right; border:1px solid black; } td.inputs{ width:200px; float:right; text-align:right; } p.products{ text-align:left; font-family:Georgia, "Times New Roman", Times, serif, 14px; } p.inputs{ text-align:left; font-family:Georgia, "Times New Roman", Times, serif, 14px; } input.inputs{ width:30px; background-color:CCCCCC; } p.calculate{ text-align:left; font-family:Georgia, "Times New Roman", Times, serif, 14px; } </style> <?php $header = $_POST['header']; $productid = $_POST['group1']; $width = $_POST['width']; $height = $_POST['height']; $openings = $_POST['openings']; $clearpanel = $_POST['clearpanel']; $resident = $_POST['resident']; $color = $_POST['color']; $motor = $_POST['motor']; $priceperheader=.5833; //error checking, ensures all variables are numeric between calculatable values 0 and 999 if($width>=0 && $width<=999 && $height>=0 && $height<=999 && $openings>=0 && $openings<=999 && $clearpanel>=0 && $clearpanel<=999) { $width2=$width+6; $height2=$height+6; if($productid == 'Roll-down Shutters') { $height2=$height2+4; } $wh=$width2*$height2; if($header=='yes') { $he=$openings*$width; $he=$he*$priceperheader; } else { $he=0; } if($resident=='yes') { $tax=1.085; } else { $tax=1; } if($motor=='2') { $motor=488*$openings; } else { $motor=0; } //$cl=$clearpanel*$priceperclearpanel; //echo(' ' + $wh + ' ' + $he + ' ' + $cl + ' '); //divide sq ft by 144 to get sq inches ////.050 alum =$4.94 per sq ft ////24 gauge steel =$3.72 per sq ft ////change Protexan to Lexan =9.94 sq ft ////roll downs = $24.99 per sq ft motor = $488. ////bahama impact = 25.99 sq ft no impact 21 per sq ft ////colonial impact = 25.99 and non = 21 sq ft ////Hurricane Fabric $6.38 per sq ft //All prices are self install only installation is extra and highly reccommended ////F track = $1.79 per ft ////H track = $2.29 per ft ////Texas residents add 8.25 percent sales tax //Standard Clamshell<input type='radio' name='group1' value='Standard Clamshell' onFocus="enable5()"><br /> //Impact Clamshell<input type='radio' name='group1' value='Impact Clamshell' onFocus="enable5()"><br /> //.063 Aluminum Panels<input type='radio' name='group1' value='.063 Aluminum Panels' onFocus="enable1()"><br /> //Accordian Shutters<input type='radio' name='group1' value='Accordian Shutters' onFocus="enable4()" /><br /> function sum($productid, $priceperopening, $wh, $he, $tax, $motor, $width, $height, $width2, $height2) { $wh=$wh*$priceperopening; $subtotal=$wh+$he; $subtotal=$subtotal+$motor; $total=$subtotal*$tax; $tax=$total-$subtotal; echo("<table><tr ><td>Product</td><td>Measured Opening</td><td>Finished Opening</td></tr> <tr><td >" . $productid . "</td><td align'right'>" . $width . " x " . $height . "</td><td align'right'>" . $width2 . " x " . $height2 . "</td></tr></table> <table><tr><td></td><td class='calchead'>Shutter</td><td class='calchead'>Header</td><td class='calchead'>Motor</td><td class='calchead'>Tax</td><td class='calchead'>Total</td></tr> <tr><td>$</td><td class='calc'>". money_format('%.2n',$wh) . "</td><td width='30' class='calc'>". money_format('%.2n',$he) . "</td><td width='30' class='calc'>" . money_format('%.2n',$motor) . "</td><td width='30' class='calc'>" . money_format('%.2n',$tax) . "</td><td align='right' class='calc'>$" . money_format('%.2n',$total) . "</td></tr></table>"); } if($productid == '.050 Aluminum Panels') { $priceperopening=.03431; sum($productid, $priceperopening, $wh, $he, $tax, $motor, $width, $height, $width2, $height2); } if($productid == '24 gauge steel') { $priceperopening=.02583; sum($productid, $priceperopening, $wh, $he, $tax, $motor, $width, $height, $width2, $height2); } if($productid == 'lexan') { $priceperopening=.0659; sum($productid, $priceperopening, $wh, $he, $tax, $motor, $width, $height, $width2, $height2); } if($productid == 'Roll-down Shutters') { $priceperopening=.17354; sum($productid, $priceperopening, $wh, $he, $tax, $motor, $width, $height, $width2, $height2); } if($productid == 'Impact Bahama Shutters') { $priceperopening=.18049; sum($productid, $priceperopening, $wh, $he, $tax, $motor, $width, $height, $width2, $height2); } if($productid == 'Impact Colonial Shutters') { $priceperopening=.18049; sum($productid, $priceperopening, $wh, $he, $tax, $motor, $width, $height, $width2, $height2); } if($productid == 'Hurricane Fabric') { $priceperopening=.04431; sum($productid, $priceperopening, $wh, $he, $tax, $motor, $width, $height, $width2, $height2); } if($productid == 'Non-Impact Bahama Shutters') { $priceperopening=.14583; sum($productid, $priceperopening, $wh, $he, $tax, $motor, $width, $height, $width2, $height2); } if($productid == 'Non-Impact Colonial Shutters') { $priceperopening=.14583; sum($productid, $priceperopening, $wh, $he, $tax, $motor, $width, $height, $width2, $height2); } } else {echo('Please make sure to enter numbers greater than zero and less than 999 in all required fields.');} $header=''; ?> <script type='text/javascript'> //white() clears backs of inputs to white and is called from eable functions function white(){ document.getElementById("header").style.background='#ffffff'; document.getElementById("width").style.background='#ffffff'; document.getElementById("height").style.background='#ffffff'; document.getElementById("openings").style.background='#ffffff'; document.getElementById("resident").style.background='#ffffff'; document.getElementById("color").style.background='#ffffff'; document.getElementById("motor").style.background='#ffffff'; } //enable1-5() enables particular requested fields specific for product type and disables unused fields. function enable1() { white(); document.getElementById("header").disabled=''; document.getElementById("width").disabled=''; document.getElementById("height").disabled=''; document.getElementById("openings").disabled=''; document.getElementById("resident").checked=''; document.getElementById("resident").disabled=''; document.getElementById("color").style.background='#CCCCCC'; document.getElementById("color").value=''; document.getElementById("color").disabled='true'; document.getElementById("motor").style.background='#CCCCCC'; document.getElementById("motor").value=''; document.getElementById("motor").disabled='true'; } function enable2() { white(); document.getElementById("header").disabled=''; document.getElementById("width").disabled=''; document.getElementById("height").disabled=''; document.getElementById("openings").disabled=''; document.getElementById("resident").checked=''; document.getElementById("resident").disabled=''; document.getElementById("color").value=''; document.getElementById("color").style.background='#CCCCCC'; document.getElementById("color").disabled='true'; document.getElementById("motor").value=''; document.getElementById("motor").style.background='#CCCCCC'; document.getElementById("motor").disabled='true'; } function enable3() { white(); document.getElementById("header").checked=''; document.getElementById("header").style.background='#CCCCCC'; document.getElementById("header").disabled='true'; document.getElementById("width").disabled=''; document.getElementById("height").disabled=''; document.getElementById("openings").disabled=''; document.getElementById("resident").disabled=''; document.getElementById("resident").checked=''; document.getElementById("color").disabled=''; document.getElementById("motor").disabled=''; } function enable4() { white(); document.getElementById("header").checked=''; document.getElementById("header").style.background='#CCCCCC'; document.getElementById("header").disabled='true'; document.getElementById("width").disabled=''; document.getElementById("height").disabled=''; document.getElementById("openings").disabled=''; document.getElementById("resident").checked=''; document.getElementById("resident").disabled=''; document.getElementById("color").disabled=''; document.getElementById("motor").style.background='#CCCCCC'; document.getElementById("motor").value=''; document.getElementById("motor").disabled='true'; } function enable5() { white(); document.getElementById("header").checked=''; document.getElementById("header").disabled='true'; document.getElementById("header").style.background='#CCCCCC'; document.getElementById("width").disabled=''; document.getElementById("height").disabled=''; document.getElementById("openings").disabled=''; document.getElementById("resident").checked=''; document.getElementById("resident").disabled=''; document.getElementById("color").value=''; document.getElementById("color").disabled='true'; document.getElementById("color").style.background='#CCCCCC'; document.getElementById("motor").value=''; document.getElementById("motor").disabled='true'; document.getElementById("motor").style.background='#CCCCCC'; } </script> <title>Estimator</title> </head> <body> <div> <table> <tr> <td><p class='products'>First, select a product</p></td> <td><p class='inputs'>Then, enter dimensions and select options (in inches) that appear in white</p></td> </tr> <tr> <td class='products'> <form width='550' name='form01' method='post' action='http://www.windowguardoftexas.com/estimator.php'> .050 Aluminum Panels<input type='radio' name='group1' value='.050 Aluminum Panels' onFocus="enable1()"><br /> 24 Gauge Steel<input type='radio' name='group1' value='24 gauge steel' onFocus="enable1()"><br /> Lexan<input type='radio' name='group1' value='lexan' onFocus="enable2()"><br /> Roll-down Shutters<input type='radio' name='group1' value='Roll-down Shutters' onFocus="enable3()"><br /> Impact Bahama Shutters<input type='radio' name='group1' value='Impact Bahama Shutters' onFocus="enable4()"><br /> Impact Colonial Shutters<input type='radio' name='group1' value='Impact Colonial Shutters' onFocus="enable4()"><br /> Hurricane Fabric<input type='radio' name='group1' value='Hurricane Fabric' onFocus="enable5()"><br /> Non-Impact Bahama Shutters<input type='radio' name='group1' value='Non-Impact Bahama Shutters' onFocus="enable4()"><br /> Non-Impact Colonial<input type='radio' name='group1' value='Non-Impact Colonial Shutters' onFocus="enable4()"><br /> </td> <td class='inputs'> Add Header and F-track to openings: <input type='checkbox' name='header' class='inputs' value='yes' disabled="disabled"/><br /> Width: <input type='text' class='inputs' name='width' value='' maxlength='3'disabled='disabled' /><br /> Height: <input type='text' class='inputs' name='height' value='' maxlength='3' disabled='disabled' /><br /> Openings: <input type='text' class='inputs' name='openings' value='' maxlength='3' disabled='disabled' /><br /> Texas Resident <input type='checkbox' name='resident' class='inputs' value='yes' disabled="disabled"/><br /> Color: <select name="color" id='color' class='inputs' disabled='disabled'><br /> <option value="0" >--Select Color--</option> <option value="1" >White</option> <option value="2">Bronze</option> <option value="3">Ivory</option> <option value="3">Beige</option> </select> <br /> Motor: <select name="motor" class='inputs' disabled="disabled"><br /> <option value="0">--Select Motor--</option> <option value="1">None</option> <option value="2" >Standard</option> </select> <br /><br /> <p class='calculate'>Finally, press calculate</p> <input type='reset' name='Submit2' value='Reset'> <input type='submit' name='Submit' value='Calculate'> </td> </form> </tr> <tr><td>All prices are self install only, installation</td><td>is extra and highly reccommended</td></tr> </table> </div> </body> </html> How do I get this to work in Firefox and Safari? Why would it work in IE but not the others? I have a small form that I'm working on for a client. They want a form that their potential leads can fill out and then hit 'calculate rate'. Once this is done, the results should display on another page with a short summary of what their quote will be as well as some of the other information they filled out. It should also send an email to my client displaying the information that their lead just filled out. My only problem is I am not sure how to go about the calculation part. I know I would have to do an onSubmit, but how would I hide that calculation and then receive that number on another page. Here is the javascript for that form: Code: /* This source is shared under the terms of LGPL 3 www.gnu.org/licenses/lgpl.html You are free to use the code in Commercial or non-commercial projects */ //Set up an associative array //The keys represent the size of the cake //The values represent the cost of the cake i.e A 10" cake cost's $35 var practice_field = new Array(); practice_field["None"]=0; practice_field["Allergy and Immunology"]=4400; practice_field["Endocrinology"]=4400; practice_field["Pathology"]=4400; practice_field["Dermatology"]=4400; practice_field["Geriatrics"]=4400; practice_field["Physical Rehabilitation"]=4400; practice_field["Family Practice"]=6900; practice_field["General Practice"]=6900; practice_field["Internal Medicine"]=6900; practice_field["Oncology"]=6900; practice_field["Oral Surgery"]=6900; practice_field["Radiology"]=6900; practice_field["Gastroenterology"]=6900; practice_field["Infectious Disease"]=6900; practice_field["Nephrology"]=6900; practice_field["Ophthalmology"]=6900; practice_field["Pediatrics"]=6900; practice_field["Urology"]=6900; practice_field["Anesthesiology"]=9000; practice_field["Cosmetic Surgery"]=9000; practice_field["General Surgery"]=9000; practice_field["Neurology"]=9000; practice_field["Otolaryngology"]=9000; practice_field["Plastic Surgery"]=9000; practice_field["Vascular Surgery"]=9000; practice_field["Cardiology"]=9000; practice_field["Emergency Medicine"]=9000; practice_field["Gynecology"]=9000; practice_field["Orthopedic Surgery"]=9000; practice_field["Pain Management"]=9000; practice_field["Pulmonary Surgery"]=9000; practice_field["Neurological Surgery"]=9900; practice_field["Obstetrics"]=9900; //Set up an associative array //The keys represent the filling type //The value represents the cost of the filling i.e. Lemon filling is $5,Dobash filling is $9 //We use this this array when the user selects a filling from the form var society_member= new Array(); society_member["None"]=null; society_member["BCMA"]=0.10; society_member["DCMA"]=0.10; society_member["FOGS"]=0.10; society_member["FNS"]=0.10; society_member["PBCMS"]=0.10; society_member["FSPS"]=0.10; //This function finds the filling price based on the //drop down selection function getPracticeField() { var docPracticeField=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the select id="filling" var selectedPracticeField = theForm.elements["practice"]; //set cakeFilling Price equal to value user chose //For example filling_prices["Lemon".value] would be equal to 5 docPracticeField = practice_field[selectedPracticeField.value]; //finally we return cakeFillingPrice return docPracticeField; } //This function finds the filling price based on the //drop down selection function getSelectedSociety() { var docSelectedSociety=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the select id="filling" var selectedSociety = theForm.elements["society"]; //set cakeFilling Price equal to value user chose //For example filling_prices["Lemon".value] would be equal to 5 docSelectedSociety = society_member[selectedSociety.value]; //finally we return cakeFillingPrice return docSelectedSociety; } //candlesPrice() finds the candles price based on a check box selection function candlesPrice() { var candlePrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["includecandles"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { candlePrice=0; } //finally we return the candlePrice return candlePrice; } function insciptionPrice() { //This local variable will be used to decide whether or not to charge for the inscription //If the user checked the box this value will be 20 //otherwise it will remain at 0 var inscriptionPrice=0; //Get a refernce to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includeinscription" var includeInscription = theForm.elements["includeinscription"]; //If they checked the box set inscriptionPrice to 20 if(includeInscription.checked==true){ inscriptionPrice=0; } //finally we return the inscriptionPrice return inscriptionPrice; } function calculateTotal() { //Here we get the total price by calling our function //Each function returns a number so by calling them we add the values they return together var cakePrice = getPracticeField() + null - (getPracticeField() * getSelectedSociety()) + candlesPrice() + insciptionPrice(); //display the result var divobj = document.getElementById('totalPrice'); divobj.style.display='block'; divobj.innerHTML = "Your Pre-Paid Legal Defense Fee Will Be Around $"+cakePrice; } function hideTotal() { var divobj = document.getElementById('totalPrice'); divobj.style.display='none'; } If you look at the bottom you can see where the Function that Calculates everything is. Right now it calculates onClick. I just want it to calculate after the user has filled out the form completely and display that calculation on another page along with the rest of the information they inputted. I have a JavaScript application that needs to preserve double quote marks and apostrophes (" and ') that are entered into form fields by the user. The form data is passed through several screens using hidden fields. Right now, apostrophes work because I have the input fields coded as value="". I have not found a way for JavaScript to retrieve the field's value if double quotes are entered by the user. If I change the parameter to value='' (single quotes) then the apostrophes probably won't work. Is there a straightforward way for JavaScript to retrieve the field value containing quotes, so that I can manipulate it into a different string that can be easily passed between HTML pages? Hi Well, I am on a project. it's about quote of they but I need a hand (or some hands ) I've searched for what I need but I've got different results with GoOgle. The points a * It has to be more than for 365 days (for more than 3000 days!) * it has to be one by one (not random quote) * and it change every 24 hours without getting back for viewed quote(making mistake!) * finally, looping after viewing all quotes responses appreciated. Hello Is there any Rating System based on java or ajax for free.. Hi all. I'm coding a javascript game, and need to know how I can take this heart image, split it up frame by frame, and make it display 20 full hearts. then if i click the mouse, it will remove the top-right of the heart, followed by the bottom right, followed by the bottom left, followed by the top left of the heart. when it removes a part of the heart, it instead displays part of the "empty" frame of the heart. code: Code: <script> //2d rpg var max = 20; var img = "hearts.png"; hearts(max); function hearts(max){ for(var i = 0; i<=max-1;i++){ document.write('\<img src\=\''+img+'\'\>\<\/img\>'); } } </script> ANY help is GREATLY appreciated! Hello there I am creating a website for a friend where the user cant can choose what jobs they want to do while a event. There a are more than 300 people involved so i found a script that worked fine but it used some checkboxes, and I wat to use drop down menu (one drop down menu for every day of the event). With the checkboxes it worked fin but when I modifie the part to insert the dropdown menu and that on my webpage I choose a job and then i send it and it tells me that I haven't selected anything. I already lost 3 days of work triing to make it work but nothin succesfull.. This is the PHP code of the webpage: PHP Code: <?php include("login.php"); ?> <html> <head> <title>Tickets</title> <style> * { font-size: 11px; font-family: arial; } </style> <script> function reserveSeats() { var selectedList = getSelectedList('Reserve Seats'); if (confirm('Do you want to reserve selected seat/s ' + selectedList + '?')) { document.forms[0].oldStatusCode.value=0; document.forms[0].newStatusCode.value=2; document.forms[0].action='bookseats.php'; document.forms[0].submit(); } else { clearSelection(); } } function getSelectedList(actionSelected) { // get selected list var obj = document.forms[0].elements; var selectedList = ''; for (var i = 0; i < obj.length; i++) { if (obj[i].checked && obj[i].name == 'seats[]') { selectedList += obj[i].value + ', '; } } // no selection error if (selectedList == '') { alert('Please select a seat before clicking ' + actionSelected); return false; } else { return selectedList; } } function refreshView() { clearSelection(); document.forms[0].action='<?php echo $_SERVER['PHP_SELF']; ?>'; document.forms[0].submit(); } </script> </head> <body> <table> <tr><td width="100%" align="center"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="hidden" name="oldStatusCode" value=""/> <input type="hidden" name="newStatusCode" value=""/> <table width='100%' border='0'> <tr><td align='center'> <input type='button' value='Refresh View' onclick='refreshView();'/> </td></tr> </table> </td></tr> <tr><td width="100%" align="center"> <table width='100%' border='0'> <tr><td align='center'> <input type='button' value='Reserve Seats' onclick='reserveSeats()'/> </td></tr> </table> </td></tr> <tr><td width="100%" align="center"> <select> <?php $linkID = @ mysql_connect("......", ".....", ".....") or die("Could not connect to MySQL server"); @ mysql_select_db("......") or die("Could not select database"); /* Create and execute query. */ $query = "SELECT * from seats order by rowId, columnId desc"; $result = mysql_query($query); $prevRowId = null; $seatColor = null; $tableRow = false; //echo $result; while (list($rowId, $columnId, $status, $updatedby) = mysql_fetch_row($result)) { if ($prevRowId != $rowId) { if ($rowId != 'A') { } $prevRowId = $rowId; } else { $tableRow = false; } if ($status == 0) { $seatColor = "lightgreen"; } else { $seatColor = "red"; } if ($status == 0 || ($status == 1 && $updatedby == $_SERVER['PHP_AUTH_USER'])) { echo "<option name='seats[]' value='$rowId$columnId'>$rowId$columnId</option>"; } } echo "</tr></table></td>"; echo "</tr>"; echo "</table>"; /* Close connection to database server. */ mysql_close(); ?> </select> </td></tr> </table> </form> </body> </html> There is an atatchment of the webpage in a browser. I hope someone out there can help me figure out the probleme. Thanks alot Joris hi guys im new here. i need some help at a battle system java script im working at a wbmmorpg game and im stuck at the battle system i dont know how to make that script i tryed some methods but all were wrong. i want the battle script to calculate the following procedu attack vs deffense inteligence vs intelligence agillity vs agillity those attributes are taken from MySQL database. can you please explain or make the script for that combination or at least for one. i appreciate it thanks I have both the java script and the php files, i just need to intergrate them into eachother to display the different topics and forums: New Forum: index.php : PHP Code: <?php include('../includes/db_connect.php'); include('../includes/inc-logincheck.php'); include('../includes/inc-functions.php'); include('../includes/inc-userfunctions.php'); include('../includes/inc-menu.php'); //include('../includes/smile.php'); $strTitle='Forum'; $strMessage=''; $intUserID=$_SESSION['uID']; $fetch=$user; ////include('../includes/forumhead.php'); $forum=$_GET['forum']; $viewtopic = $_GET['viewtopic']; if ($crew == "0"){ $query="SELECT * FROM `topics` WHERE `forum`='$forum'"; } $query=mysql_query("$query"); $num=mysql_num_rows($query); $col="0"; while($fo=mysql_fetch_object($query)){ if ($col=="0"){ $td="#444444"; $col="1"; }else{ $td="#555555"; $col="0"; } $hehe=mysql_num_rows(mysql_query("SELECT * FROM replys WHERE idto='$fo->id'")); } ?> <link rel="stylesheet" type="text/css" href="../includes/forum.css"> <td width="99%" background="../game/site/site/innerbg.gif" bgcolor="#222222" valign="top"> <br> <center> <table border="0" cellspacing="0" cellpadding="10" width="100%" class="cat"> <tr> <td> <script language='JavaScript' type='text/javascript' src='../includes/scripts/autosize.js'></script> <script> var box = 'reply'; var oldTopic = 5; var muted = 'no'; var set = 0; function parseUrl(url,variable){ var theurl = url.split('?'); if(theurl[1]){ pars = theurl[1].split('&'); for(i = 0; i < pars.length; i++){ var check = pars[i].split('='); if(check[0] == variable){ return check[1]; } } } return false; } function keepRefreshed(){ if(set == 0){ refresher = setTimeout("keepRefreshed()", 60000); allowButton = setTimeout("allowRefresh()", 3000); set = 1; } else { refreshTopics(); } } function allowRefresh(){ document.replyForm.refreshButton.disabled = false; } function refreshTopics(hl){ if(set == 1){ clearTimeout(refresher); clearTimeout(allowButton); } document.replyForm.refreshButton.disabled = true; refresher = setTimeout("keepRefreshed()", 60000); allowButton = setTimeout("allowRefresh()", 3000); if(document.replyForm.editIt.value == 'x'){ currentTopics = self.frames['topicsFrame'].location.href; var page = parseUrl(currentTopics, 'page'); var forum = parseUrl(currentTopics, 'forum'); var flag = parseUrl(currentTopics, 'flag'); if(flag){ add = '&flag=' + flag; } else { add = ''; } if(!page){ page = 1; } if(!forum){ forum = 1; } if(!hl){ hl = oldTopic; } self.frames['topicsFrame'].location.href = 'topics.php?forum=' + forum + '&default=' + oldTopic + '&page=' + page + '&hl=' + hl + add; } } function updateBox(id){ oldTopic = id; if(document.replyForm.editIt.value != 'x'){ document.replyForm.editIt.value = 'x'; document.replyForm.topicSubject.disabled = false; document.replyForm.selectedFlag.disabled = false; document.replyForm.submitTitle.value = 'Add!'; switchBox(true); } else { if(box == 'reply'){ document.replyForm.replyTo.value = id; document.replyForm.action = 'view.php?id=' + id + '&forum=' + 1; } } } function emotion(em){ document.replyForm.replyMes.value = document.replyForm.replyMes.value + em; document.replyForm.replyMes.scrollTop = document.replyForm.replyMes.scrollHeight; } function editThread(id, flag, points){ mes = self.frames['repliesFrame'].document.getElementById('topicMessage').value; sub = self.frames['repliesFrame'].document.getElementById('topicSubject').innerHTML; var replyform = document.replyForm; if(box == 'reply'){ switchBox(); } document.getElementById('topHeader').innerHTML = 'Edit thread'; replyform.topicSubject.value = sub; replyform.topicSubject.disabled = true; replyform.replyMes.value = mes; replyform.replyMes.focus(); replyform.editIt.value = id; replyform.selectedFlag.value = flag; replyform.selectedFlag.disabled = true; checkPoints(); replyform.addPoints.value = points; replyform.submitTitle.value = 'Edit!'; } function addQuote(type, username, id){ if(type == 'topic'){ quote = self.frames['repliesFrame'].document.getElementById('topicMessage'); } else { quote = self.frames['repliesFrame'].document.getElementById('quote_' + id); } format = '[quote=' + username + ']' + quote.innerHTML + '[/quote]\n\n'; document.replyForm.replyMes.value = document.replyForm.replyMes.value + format; document.replyForm.replyMes.scrollTop = 0; document.replyForm.replyMes.scrollTop = document.replyForm.replyMes.scrollHeight; } function switchBox(c,k){ if(document.replyForm.editIt.value != 'x'){ updateBox(oldTopic); return; } if((box == 'reply') && (!k)){ document.replyForm.action = 'topics.php?forum=1'; document.replyForm.target = 'topicsFrame'; document.replyForm.replyTo.value = 'x'; document.getElementById('topHeader').innerHTML = 'New topic'; document.getElementById('title').innerHTML = 'Add reply'; document.getElementById('topicTitle').style.display = 'block'; if(1 == 1){ document.getElementById('flagBox').style.display = 'block'; } box = 'topic'; } else { if(c){ document.replyForm.topicSubject.value = ''; document.replyForm.replyMes.value = ''; document.replyForm.addPoints.value = ''; document.replyForm.selectedFlag.value = 1; if(k){ url = 'topics.php?forum=1&hl=' + k; if(1 == 1){ if(document.replyForm.forumFilter.value){ url = url + '&flag=' + document.replyForm.forumFilter.value; } } self.frames['topicsFrame'].location.href = url; } } document.replyForm.action = 'view.php?id=' + oldTopic + '&forum=' + 1; document.replyForm.target = 'repliesFrame'; document.replyForm.replyTo.value = oldTopic; document.getElementById('topHeader').innerHTML = 'Add reply'; document.getElementById('title').innerHTML = 'Add topic'; document.getElementById('topicTitle').style.display = 'none'; document.getElementById('flagBox').style.display = 'none'; document.getElementById('addPoints').style.display = 'none'; box = 'reply'; } if(box == 'reply'){ updateButton(false); } else { checkPoints(); updateButton(true); } } function displayError(message){ if(message == 'clear'){ switchBox(true); document.getElementById('forumError').style.display = 'none'; document.getElementById('forumError').innerHTML = ''; } else { document.getElementById('forumError').style.display = 'block'; document.getElementById('forumError').innerHTML = message; } } var timel = 0; function countdown(){ timel -= 1; if(timel <= 0){ unMute(); } else { minutes = Math.floor(timel / 60); seconds = timel - (minutes * 60); document.getElementById('timeleft').innerHTML = '<b>Time left:</b> ' + minutes + ' minutes ' + seconds + ' seconds'; setTimeout("countdown()", 1000); } } function mutePlayer(muter, reason, post, timeleft){ muted = 'yes'; timel = timeleft; minutes = Math.floor(timeleft / 60); seconds = timeleft - (minutes * 60); document.getElementById('muteBox').innerHTML = 'You are unable to post because you have been muted by: <a href="viewprofile.php?viewuser=' + muter + '">' + muter + '</a><br><br><b>Reason:</b> ' + reason + '<br><div id="timeleft"><b>Time left:</b> ' + minutes + ' minutes ' + seconds + ' seconds</div><b>Post:</b><br>' + post; document.getElementById('replyBox').style.display = 'none'; document.getElementById('muteBox').style.display = 'block'; setTimeout("countdown()", 1000); } function unMute(){ muted = 'no'; document.getElementById('replyBox').style.display = 'block'; document.getElementById('muteBox').style.display = 'none'; } function checkPoints(){ var flag = document.replyForm.selectedFlag; if(flag.value == 13){ document.getElementById('addPoints').style.display = 'block'; } else { document.getElementById('addPoints').style.display = 'none'; } if(flag.value <= 3){ updateButton(true); } else { updateButton(false); } } function updateButton(upto){ if(1 == 1){ var button = document.replyForm.submitTitle; var flag = document.replyForm.selectedFlag; if((upto) && (flag.value <= 3)){ button.disabled = true; } else { button.disabled = false; } } } function updateFilter(){ var flag = document.replyForm.forumFilter.value; if(flag != 'void'){ url = 'topics.php?forum=1'; if(flag != 'all'){ url += '&flag=' + flag; } self.frames['topicsFrame'].location.href = url; } } function watchThread(){ url = 'topics.php?forum=1&hl=' + oldTopic + '&watch=' + oldTopic; if(document.replyForm.forumFilter.value){ url = url + '&flag=' + document.replyForm.forumFilter.value; } self.frames['topicsFrame'].location.href = url; } </script> <div id="forumError" display="none"></div> <center> <table border=0 cellspacing=0 cellpadding=2 width=99% bordercolor=black> <tr> <td width=40% valign=top class="insideTables"> <form name="replyForm" method="post" target="repliesFrame" action="view.php?id=5&forum=1"> <table border=1 cellspacing=0 cellpadding=2 width=100% class=sub2 bordercolor=black> <tr> <td align=center class=header><div id="topHeader">Add reply</div></td> </tr> <tr> <td> <div id="replyBox"> <div style="display:none;" id="topicTitle">Subject: <input type=text style="width:100%" name="topicSubject" maxlength=35><br>Message:<br></div> <textarea style="width:100%" rows=5 name="replyMes" style="white-space: normal;"></textarea> <div style="display:none;" id="flagBox"> <select style="width:100%;" name="selectedFlag" onChange="javascript:checkPoints()"><option selected value="1" style="background-color:#CDCDCD;">--- GAME RELATED ---</option> <option value="4" style="background-color:#69A16C;">Questions/Help</option> <option value="5" style="background-color:#69A16C;">Feature Discussion</option> <option value="6" style="background-color:#69A16C;">RIP/WS</option> <option value="7" style="background-color:#69A16C;">Bust Party</option> <option value="8" style="background-color:#69A16C;">Promotions</option> <option value="22" style="background-color:#69A16C;">Other</option> <option value="2" style="background-color:#CDCDCD;">--- OFF TOPIC ---</option> <option value="9" style="background-color:#CCAB6B;">Contests & Games</option> <option value="10" style="background-color:#CCAB6B;">Bars</option> <option value="11" style="background-color:#CCAB6B;">Rate THIS</option> <option value="21" style="background-color:#CCAB6B;">Sports</option> <option value="23" style="background-color:#CCAB6B;">Movies, Music & TV</option> <option value="24" style="background-color:#CCAB6B;">Other</option> <option value="3" style="background-color:#CDCDCD;">--- CLASSIFIEDS ---</option> <option value="13" style="background-color:#6B9FCC;">Points</option> <option value="14" style="background-color:#6B9FCC;">Crew</option> <option value="15" style="background-color:#6B9FCC;">Pictures & Music</option> <option value="16" style="background-color:#6B9FCC;">Casino</option> <option value="17" style="background-color:#6B9FCC;">Protection</option> <option value="18" style="background-color:#6B9FCC;">Organized Crime</option> <option value="19" style="background-color:#6B9FCC;">Establishment</option> <option value="20" style="background-color:#6B9FCC;">Other</option> </select> </div> <div style="display:none;" id="addPoints"> Verify: <input type=text name="addPoints" size=5> </div> <br> <input type=hidden name="replyTo"> <input type=hidden name="editIt" value="x"> <center> <a onclick="emotion(' :arrow: ')" style="cursor: pointer;"><img src="../game/emotions/arrow.gif" border=0 alt=":arrow:"></a> <a onclick="emotion(' :D ')" style="cursor: pointer;"><img src="../game/emotions/biggrin.gif" border=0 alt=":D"></a> <a onclick="emotion(' :S ')" style="cursor: pointer;"><img src="../game/emotions/confused.gif" border=0 alt=":S"></a> <a onclick="emotion(' 8) ')" style="cursor: pointer;"><img src="../game/emotions/cool.gif" border=0 alt="8)"></a> <a onclick="emotion(' :\'( ')" style="cursor: pointer;"><img src="../game/emotions/cry.gif" border=0 alt=":'("></a> <a onclick="emotion(' 8| ')" style="cursor: pointer;"><img src="../game/emotions/eek.gif" border=0 alt="8|"></a> <a onclick="emotion(' :evil: ')" style="cursor: pointer;"><img src="../game/emotions/evil.gif" border=0 alt=":evil:"></a> <a onclick="emotion(' :!: ')" style="cursor: pointer;"><img src="../game/emotions/exclaim.gif" border=0 alt=":!:"></a> <a onclick="emotion(' :idea: ')" style="cursor: pointer;"><img src="../game/emotions/idea.gif" border=0 alt=":idea:"></a> <a onclick="emotion(' :lol: ')" style="cursor: pointer;"><img src="../game/emotions/lol.gif" border=0 alt=":lol:"></a> <a onclick="emotion(' :mad: ')" style="cursor: pointer;"><img src="../game/emotions/mad.gif" border=0 alt=":mad:"></a> <br> <a onclick="emotion(' :?: ')" style="cursor: pointer;"><img src="../game/emotions/question.gif" border=0 alt=":?:"></a> <a onclick="emotion(' :redface: ')" style="cursor: pointer;"><img src="../game/emotions/redface.gif" border=0 alt=":redface:"></a> <a onclick="emotion(' :rolleyes: ')" style="cursor: pointer;"><img src="../game/emotions/rolleyes.gif" border=0 alt=":rolleyes:"></a> <a onclick="emotion(' :( ')" style="cursor: pointer;"><img src="../game/emotions/sad.gif" border=0 alt=":("></a> <a onclick="emotion(' :) ')" style="cursor: pointer;"><img src="../game/emotions/smile.gif" border=0 alt=":)"></a> <a onclick="emotion(' :o ')" style="cursor: pointer;"><img src="../game/emotions/surprised.gif" border=0 alt=":o"></a> <a onclick="emotion(' :P ')" style="cursor: pointer;"><img src="../game/emotions/toungue.gif" border=0 alt=":P"></a> <a onclick="emotion(' :twisted: ')" style="cursor: pointer;"><img src="../game/emotions/twisted.gif" border=0 alt=":twisted:"></a> <a onclick="emotion(' ;) ')" style="cursor: pointer;"><img src="../game/emotions/wink.gif" border=0 alt=";)"></a> <a onclick="emotion(' :tdn: ')" style="cursor: pointer;"><img src="../game/emotions/tdown.gif" border=0 alt=":tdn:"></a> <a onclick="emotion(' :tup: ')" style="cursor: pointer;"><img src="../game/emotions/tup.gif" border=0 alt=":tup:"></a> <br> <input type=submit value="Add!" name="submitTitle"> <input type=button value="Watch!" onClick="javascript:watchThread()"> <input type=button value="Refresh!" name="refreshButton" onClick="javascript:refreshTopics()"> </center> </div> <div id="muteBox" style="display:none;"></div> </td> </tr> <tr> <td align=center class=header>Topics (<a href="javascript:switchBox()" id="title">Add topic</a>)</td> </tr> <tr> <td> <select style="width:100%;" onChange="javascript:updateFilter()" name="forumFilter"> <option value="void" style="background-color:#CDCDCD;"> FILTER</option> <option value="all">View all</option> <option selected value="1" style="background-color:#CDCDCD;">--- GAME RELATED ---</option> <option value="4" style="background-color:#69A16C;">Questions/Help</option> <option value="5" style="background-color:#69A16C;">Feature Discussion</option> <option value="6" style="background-color:#69A16C;">RIP/WS</option> <option value="7" style="background-color:#69A16C;">Bust Party</option> <option value="8" style="background-color:#69A16C;">Promotions</option> <option value="22" style="background-color:#69A16C;">Other</option> <option value="2" style="background-color:#CDCDCD;">--- OFF TOPIC ---</option> <option value="9" style="background-color:#CCAB6B;">Contests & Games</option> <option value="10" style="background-color:#CCAB6B;">Bars</option> <option value="11" style="background-color:#CCAB6B;">Rate THIS</option> <option value="21" style="background-color:#CCAB6B;">Sports</option> <option value="23" style="background-color:#CCAB6B;">Movies, Music & TV</option> <option value="24" style="background-color:#CCAB6B;">Other</option> <option value="3" style="background-color:#CDCDCD;">--- CLASSIFIEDS ---</option> <option value="13" style="background-color:#6B9FCC;">Points</option> <option value="14" style="background-color:#6B9FCC;">Crew</option> <option value="15" style="background-color:#6B9FCC;">Pictures & Music</option> <option value="16" style="background-color:#6B9FCC;">Casino</option> <option value="17" style="background-color:#6B9FCC;">Protection</option> <option value="18" style="background-color:#6B9FCC;">Organized Crime</option> <option value="19" style="background-color:#6B9FCC;">Establishment</option> <option value="20" style="background-color:#6B9FCC;">Other</option> </select> </td> </tr> <tr> <td> <iframe width=100% height="357" src="topics.php?forum=1&flag=<?php echo "$forum"; ?>" frameborder="0" allowTransparency="true" name="topicsFrame" id="topicsFrame"></iframe> </td> </tr> </table> </form> </td> <td width=60% valign=top> <iframe width=100% height="590" src="view.php?forum=1&id=<?php echo "$viewtopic"; ?>" frameborder="0" id="repliesFrame" name="repliesFrame" allowTransparency="true"></iframe> </td> </tr> </table> </td> </tr> </table> </td> <?php include("/home/tacticsc/domains/360-tactics.co.uk/public_html/crimewave/includes/inc-footer.php"); ?> i will post the rest of the codes in comments below due to too many word count. if its not to hard please help me, i have put all the Javascript there and the php it just needs to be implimented, i have started some of it, such as getting the topics to display like so: its just when you click the topic it doesnt load into the right hand iframe and some other things like the reply box ect thanks. Dan I run a site on tumblr. I know its not as good as wordpress and doesn't allow as many options but I am looking to create a unique voting option for each post. Like an up down vote. Any ideas on how to set this up? Can it be done? Thanks, Thomas Hi all, I am trying to achieve a star rating system (a simple one) without the need to store the data in a database... Basically I need 5 stars on the screen and for people to be able to click on those and them to turn yellow (i'm sure people have seen this before). I have had a go, substituting stars for radio buttons to try and get it going but I'm having problems getting it to work. This is what I have so far: Code: <script type="text/javascript"> var half_total = 0; function recalculate(){ half_total = 0; var el = document.getElementsByTagName('input'); for(i=0;i<el.length;i+=1){ if(el[i].className=="star_rating"){ if(el[i].checked){ if(parseInt(el[i].value)==1){ half_total += parseInt(el[i].value); } } } } document.getElementById('rating_total').innerHTML = half_total / 2; } window.onload = function(){ var el = document.getElementsByTagName('input'); for(i=0;i<el.length;i+=1){ if(el[i].className=="star_rating"){ el[i].onclick = recalculate; } } recalculate(); } </script> Code: <label>Rate our service out of 5 stars:</label> <input type="radio" name="rating" class="star_rating" value="1" /> <input type="radio" name="rating" class="star_rating" value="1" /> <input type="radio" name="rating" class="star_rating" value="1" /> <input type="radio" name="rating" class="star_rating" value="1" /> <input type="radio" name="rating" class="star_rating" value="1" /> You have currently rated us <td id="rating_total">0</td>/5<br/> Could someone who is more experienced help with this? Many thanks, Greens85 |