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 7411539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:24:06+00:00 2026-05-29T06:24:06+00:00

I have a function with info that grabs hours, rates, and then tax deduction

  • 0

I have a function with info that grabs hours, rates, and then tax deduction and then spits it out. It works fine

 var newtax= new Number(dep[i]);
 taxrate = newtax*100;
 var h=eval(document.paycheck.hours.value);
 var r=eval(document.paycheck.payrate.value);
 document.paycheck.feedback.value= taxrate + txt;
 var total= r*(1-newtax)*h ;
 total=total.toFixed(2);
 document.paycheck.feedback3.value= ("$ "+ total);

I have to put where it takes the total and puts it in a function to put it only two decimals. It works this way and only does two decimals but i need the decimal conversion in a function. can anyone shed some like .

This is where i cut it to two decimals and i am unable to put in function and then send it back to the feedback3.value.

 total=total.toFixed(2);
 document.paycheck.feedback3.value= ("$ "+ total);
  • 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-05-29T06:24:07+00:00Added an answer on May 29, 2026 at 6:24 am

    If you’re asking how to write a function that takes a number and formats it as a dollar value with two decimals (as a string) then this would work:

    function formatMoney(num) {
       return "$ " + num.toFixed(2);
    }
    
    // which you could use like this:
    document.paycheck.feedback3.value= formatMoney(total);
    
    // though you don't need the total variable (unless you use it elsewhere)
    // because the following will also work:
    document.paycheck.feedback3.value = formatMoney( r*(1-newtax)*h );
    

    By the way, you don’t need eval to get the values from your fields. Just say:

    var h = document.paycheck.hours.value;
    var r = document.paycheck.payrate.value;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: $('.user_info').click(function(){ var pos = $(this).offset(); rel_value = $(this).attr('rel'); $('#' +
I have function getCartItems in cart.js and I want to call that function in
So I have function that formats a date to coerce to given enum DateType{CURRENT,
In my Java code I have function that gets file from the client in
I have a function that gives me the following warning: [DCC Warning] filename.pas(6939): W1035
I have a function that calls two other functions: class myClass{ function myFunc(){ for($i=0;$i<500;$i++){
I've been trying to figure out how the malloc_info() function located in malloc.h works.
i have function public Menu Details(int? id) { return _dataContext.Menu.Include(ChildMenu).FirstOrDefault(m => m.MenuId == id);
I have function: char *zap(char *ar) { char pie[100] = INSERT INTO test (nazwa,
If I have function names stored as strings in a Hashtable. Is there a

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.