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 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2005
    Location
    California
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Help with reset button

    Here is my code i cant seem to get the reset button to work??

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Price Quote</title>
    </head>
    
    
    <script>
    function doCalculation()
    {
    	var g = parseFloat(document.getElementById('originalGunPrice').value);
    	var s = parseFloat(document.getElementById('shipping').value);
    	var x = (g * 1.1 * 1.0725) + s + 25;
                 x=Math.round(x*100)/100
    	document.getElementById('calculatedPrice').value = x;
    	return false;
    }
    </script>
    </head>
    
    <body>
    	<p>&nbsp;</p>
    	<p>&nbsp;</p>
    	<p align="left">	 
    	    Gun Price&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	  <input id="originalGunPrice" type="text" value="0">
    </p>
    	<p>
    		10% Handling&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       	    <input name="h" type="text" id="10%" value="10%" readonly="true">
    	</p>
    	<p>
    		Tax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	    <input name="t" type="text" value=".0725" readonly="true">
    	</p>
    	<p>
    		Shipping&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   
    	  <input id="shipping" type="text" value="0"> 
    	</p>
    	<p>
    		DROS Fees&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
    	    <input name="f" type="text" value="+$25" readonly="true">
    	</p>
    	<p>&nbsp;</p>
    	<p>&nbsp;</p>
    	<p>
    		<input name="Calcuate" type="submit" onClick="doCalculation();">
    		<input name="reset" type="reset">
    
    	</p>
      	<p>
    		Price Quote:
    		  <input id="calculatedPrice" type="text">
    	</p>
    	<p>&nbsp;</p>
    
    </body>
    </html>
    -Bryce
    It doesn't matter how long my hair is or what colour my skin is or whether I'm a woman or a man. -John Lennon

  • #2
    New Coder
    Join Date
    Dec 2005
    Location
    Dallas, TX
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm about 95% sure your problem there is that it all has to be enveloped in a <form>. Try putting that in. If it doesn't work, you could always just make a Javascript function to do it instead.
    Owner - Osiris Incorporated

    PHP and MySQL pro, and always willing to help.

  • #3
    New Coder
    Join Date
    Jun 2005
    Location
    California
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, that makes the reset button work lol but now when you hit the submit button it just refreshes the page and resets everything??
    -Bryce
    It doesn't matter how long my hair is or what colour my skin is or whether I'm a woman or a man. -John Lennon

  • #4
    New Coder
    Join Date
    Dec 2005
    Location
    Dallas, TX
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oops, my bad. Add

    Code:
    onSubmit="return false;"
    to the end of your opening <form> tag. That'll fix it.
    Owner - Osiris Incorporated

    PHP and MySQL pro, and always willing to help.

  • #5
    New Coder
    Join Date
    Jun 2005
    Location
    California
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks so much!!!
    -Bryce
    It doesn't matter how long my hair is or what colour my skin is or whether I'm a woman or a man. -John Lennon


  •  

    Posting Permissions

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