473,395 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

number round up

10
hai all,

how to round up the number to the thousand?

the situation like this:

<tr>
<td>Ist Amount</td>
<td>:</td>
<td><input name="stamt" type="text" " size="20" ></td>
</tr>

<tr>
<td>2nd Amount</td>
<td>:</td>
<td><input name="ndmt" type="text" size="20"></td>
</tr>



If the user key in 153060 at the Ist Amount field, and after he press the tab key,
the 2nd Amount field will automatically convert the 153060 to the nearest thousand. so the valaue should be 153000 at the 2nd Amt field.

thx..
Oct 28 '06 #1
2 1982
vee10
141 100+
hi,

i think this code helps u and it's working

Expand|Select|Wrap|Line Numbers
  1.  
  2. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
  3.  
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5.  
  6. <html xmlns="http://www.w3.org/1999/xhtml" >
  7. <head runat="server">
  8.     <title>Untitled Page</title>
  9.     <script type="text/javascript" >
  10.  
  11.     function amount()
  12.     {
  13.  
  14.     var amt=document.getElementById("stamt").value;
  15.     var sub1=amt.substring(amt.length-3,amt.length);
  16.     var sub=sub1;
  17.     sub=amt-sub;  
  18.     if(sub1.substring(0,1)>5)
  19.     {    
  20.      sub=parseInt(sub)+1000;
  21.     }
  22.     document.getElementById("ndmt").value=sub;
  23.  
  24.     }
  25.  
  26.     </script>
  27. </head>
  28. <body>
  29.     <form id="form1" runat="server">
  30.     <div>
  31. <table>
  32.     <tr>
  33. <td>Ist Amount</td>
  34. <td>:</td>
  35. <td><input name="stamt" type="text" size="20" /></td> 
  36. </tr> 
  37.  
  38. <tr>
  39. <td>2nd Amount</td>
  40. <td>:</td>
  41. <td><input name="ndmt" type="text" size="20" onfocus="amount();"/></td>
  42. </tr>
  43. </table>
  44.     </div>
  45.     </form>
  46. </body>
  47. </html>
  48.  
  49.  
  50.  


hai all,

how to round up the number to the thousand?

the situation like this:

<tr>
<td>Ist Amount</td>
<td>:</td>
<td><input name="stamt" type="text" " size="20" ></td>
</tr>

<tr>
<td>2nd Amount</td>
<td>:</td>
<td><input name="ndmt" type="text" size="20"></td>
</tr>



If the user key in 153060 at the Ist Amount field, and after he press the tab key,
the 2nd Amount field will automatically convert the 153060 to the nearest thousand. so the valaue should be 153000 at the 2nd Amt field.

thx..
Oct 31 '06 #2
java
10
thx for help.
Nov 1 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Schklerg | last post by:
I have this script performing a calculation on a page on my site: <script language="JavaScript"> function compute_weight(form) { var weight = form.wt.value; var pgs = form.pgs.value; var ppi =...
3
by: Ricardo Garcia | last post by:
hi, i have some file size in bytes, and i want to get it in KB or MB, with one decimal digit, for example: 1268777 -> 1.2 MB now i can have 1.210000... my question is how do you can round this...
3
by: Videotron | last post by:
I would like to know how to round a number to its higher value (Ex. 5.3=6 5.5=6 5.9=6 and 5.1=6) I'm trying to do it with a simple expression =(Round(;1))* thanks in advance markfou
6
by: Penguin | last post by:
At some long ago time Steve Jorgensen answered thus: Subject: Re: How can I round a time? Newsgroups: comp.databases.ms-access Date: 1998/12/11 Access represents a date internally as a double...
15
by: Papajo | last post by:
Hi, This script will write a random number into a document write tag, I've been trying to get it to write into a input form box outside the javascript, any help is appreciated. Thanks Joe ...
4
by: Chris Davoli | last post by:
The folllowing will round to 526, but it should round to 527. It works correctly for all other numbers, except for this one. Does anybody know of a bug in Math.Round? Dim ldecWater As Decimal =...
28
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
4
by: Jassim Rahma | last post by:
I have a number, for example 0.152 or 1.729 and I want to allow to round to the first 0.010 or 0.050 or 0.100
6
by: dkirkdrei | last post by:
I am looking for a way to round a number (which will be displayed as a dollar amount) to the nearest nickel. Using the php round function only allows you to control the number of decimal places in...
30
by: bdsatish | last post by:
The built-in function round( ) will always "round up", that is 1.5 is rounded to 2.0 and 2.5 is rounded to 3.0. If I want to round to the nearest even, that is my_round(1.5) = 2 # As...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.