Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8759581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:50:32+00:00 2026-06-13T14:50:32+00:00

In my Code my whole function is runing once means their is no break

  • 0

In my Code my whole function is runing once means their is no break point. the program run like this that when i give value in 1st text box it will gives me 0 in all text boxes which i have made.Please tell me what i do.My coding is:

<html>
<head>
<title>Puchase Recipt</title>
<script type="text/javascript">
function recipt()
{
var a = Number(document.f1.amount.value);
var b = Number(document.f1.quantity.value);
var pro = a*b;
if (pro > 100)
{
    var c = Number(document.f1.discount.value);
    var per = Number(pro * c / 100);
    var d = Number(document.f1.subtract.value);
    document.f1.subtract.value = per;
    }
var e = Number(document.f1.total.value);
var total = pro - per;
document.f1.total.value = total;
}
</script>
</head>
<body>
<h1>Purchase Recipt</h1>
<table border="1" bordercolor="#000099">
<form name="f1">
<tr>
<th>Amount per KG</th>
<td><input type="text" placeholder="Amount" name="amount" onChange="recipt()"/></td>
</tr>
<tr>
<th>Quntity of item</th>
<td><input type="text" placeholder="Quantity" name="quantity" onChange="recipt()"/></td>
</tr>
<tr>
<th>Discount in %</th>
<td><input type="text" placeholder="Discount" name="discount" onChange="recipt()"/></td>
</tr>
<tr>
<th>Deduct Amount</th>
<td><input type="text" placeholder="Deduct Amount" name="subtract" onChange="recipt()"/></td>
</tr>
<tr>
<th>Total Amount</th>
<td><input type="text" placeholder="Total Amount" name="total" onChange="recipt()"/></td>
</tr>
<th>Reset</th>
<td><input type="reset"/></td>
</tr>
</form>
</table>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:50:33+00:00Added an answer on June 13, 2026 at 2:50 pm

    Try with this code in javascript..

    function recipt()
    {
    var a = Number(document.f1.amount.value);
    var b = Number(document.f1.quantity.value);
    var pro = a*b;
    var per=0;
    if (pro > 100)
    {
        var c = Number(document.f1.discount.value);
        per = Number(pro * c / 100);
        var d = Number(document.f1.subtract.value);
        document.f1.subtract.value = per;
        }
    var e = Number(document.f1.total.value);
    var total = pro - per;
    document.f1.total.value = total;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function in my program that preforms a whole bunch of floating
I have written code to perform a function that could take a while to
I need to write a delegate function that can 'wrap' some while/try/catch code around
I am getting the following error while running the code, Warning: require_once(product.php) [function.require-once]: failed
Scenario: a program running in a byte code virtual machine like Java or Python,
I'm having trouble understanding the screen timeout function and how that will effect code
I have a function foo that only stops once a condition has been met.
I was playing around with the following code: function recaller(){ while(x-- > 0)recaller(); }
While I'm going through Python code and seeing functions called, I notice things like
The whole code is written in ANSI C, and it should remain so. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.