.::AGNA::.

Advertisement

.::AGNA::.

Advertisement

کد جاوایی که ۵۰در صد وبلاگ های خارجی گذاشتن

Description: A useful utility that rounds any number to the specified decimal place. This is needed because JavaScript doesn't have any built-in methods for the task. The function takes two parameters- a number (has to be a number datatype), and the number of places to round it to.

Example: n/a

Directions: Add this script to your page:

To round numbers using it, simply invoke the function:

roundit(78.4333, 2)

where the first parameter (78.4333) is the number to round, and the second (2), the number of decimals to round it to. For example, the following alerts this processed number:

<script>
//alerts 78.43
alert(roundit(78.4333,2))
</script>

نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد