Javascript function to convert the input text in money format.

Javascript Code:

 

function formatAsMoney(ObjVal)

        {

            //Obj.value = formatAsMny(Obj.value)

            mnt = ObjVal;

            mnt -= 0;

            mnt = (Math.round(mnt*100))/100;

            ObjVal = (mnt == Math.floor(mnt)) ? mnt + '.00' : ( (mnt*10 == Math.floor(mnt*10)) ? mnt + '0' : mnt);

            if (isNaN(ObjVal)) {ObjVal ="0.00";}

            return ObjVal;

        }

Ebook Download
View all
Learn
View all