<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function FormatLongNumber()
{
var value=parseFloat(document.getElementById('price').value);
if(value == 0)
{
document.getElementById('price1').value=0;
}
else
{
if(value <= 999)
{
document.getElementById('price1').value=value;
}
else if(value >= 1000 && value <= 99999)
{
var num=(value / 1000);
document.getElementById('price1').value=parseFloat(num).toFixed(2) + 'K';
}
else if(value >= 100000 && value <= 9999999)
{
var num=(value / 100000);
document.getElementById('price1').value=parseFloat(num).toFixed(2) + 'L';
}
else if(value >= 10000000 && value <= 999999999)
{
var num=(value / 10000000);
document.getElementById('price1').value=parseFloat(num).toFixed(2) + 'Cr';
}
else if(value >= 1000000000 && value <= 99999999999){
var num=(value / 1000000000);
document.getElementById('price1').value=parseFloat(num).toFixed(2) + 'B';
}
else
document.getElementById('price1').value=value;
}
}
</script>
</head>
<body>
<form method="post">
Price:<input type="test" id="price" name="price" onkeyup="FormatLongNumber()" maxlength="11">
Price1:<input type="test" id="price1" name="price1" >
</form>
</body>
</html>
<html>
<head>
<title></title>
<script type="text/javascript">
function FormatLongNumber()
{
var value=parseFloat(document.getElementById('price').value);
if(value == 0)
{
document.getElementById('price1').value=0;
}
else
{
if(value <= 999)
{
document.getElementById('price1').value=value;
}
else if(value >= 1000 && value <= 99999)
{
var num=(value / 1000);
document.getElementById('price1').value=parseFloat(num).toFixed(2) + 'K';
}
else if(value >= 100000 && value <= 9999999)
{
var num=(value / 100000);
document.getElementById('price1').value=parseFloat(num).toFixed(2) + 'L';
}
else if(value >= 10000000 && value <= 999999999)
{
var num=(value / 10000000);
document.getElementById('price1').value=parseFloat(num).toFixed(2) + 'Cr';
}
else if(value >= 1000000000 && value <= 99999999999){
var num=(value / 1000000000);
document.getElementById('price1').value=parseFloat(num).toFixed(2) + 'B';
}
else
document.getElementById('price1').value=value;
}
}
</script>
</head>
<body>
<form method="post">
Price:<input type="test" id="price" name="price" onkeyup="FormatLongNumber()" maxlength="11">
Price1:<input type="test" id="price1" name="price1" >
</form>
</body>
</html>
ConversionConversion EmoticonEmoticon