-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: SivaDotNet
Message 5 in Discussion

Hi, Prob 1:   Here is some javascript as per ur req. call this script on onblur event 
of ur Textbox It will format the number as per ur req.   Function1: function 
round(num, decPlaces)
{
 var intFactor = 1
 for(i=0; i<decPlaces; i++)
  intFactor = intFactor * 10;
  
 return (Math.round(num * intFactor)/intFactor)
}   Function2: function format_number(pnumber,decimals) 
{  
  if (pnumber==0){return '0.00'};
  if (isNaN(pnumber)) {return 0};  
  if (pnumber=='') { return 0};  
   
  var IsNegative=(parseInt(pnumber)<0); 
  if(IsNegative)pnumber=-pnumber;    var snum = new String(pnumber);  
  var sec = snum.split('.');  
  var whole = parseInt(sec[0]);  
  var result = '';  
  if(sec.length > 1){  
    var dec = new String(sec[1]);  
    dec = parseInt(dec)/Math.pow(10,parseInt(dec.length-decimals-1)); 
 Math.round(dec); 
 dec = parseInt(dec)/10; 
 dec=String(dec);
 
 if (isNaN(whole)) {whole='0'};
 if (dec==0) { dec='00'};
 if (dec.length==1){dec='0'+dec};
  
 //alert(dec.length);
 return (whole + '.' + dec);
 
  }
  else
  {
 return (pnumber+'.00'); 
  }
  
}
<DECPLACES; 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to