|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Entering decimal numbers only in javascript
Hello!!
Do you know of any solutions to this following problem: preventing the user from inputting whole numbers (integers) and allowing the user to enter the decimal numbers instead? Thanks!!! |
|
#2
|
|||
|
|||
|
RE: Entering decimal numbers only in javascript
I came up with this, which seems to work.
Code:
<script language="javascript">
<!--
function isFloat(num){
if(isNaN(num) || num.indexOf(".")<0){
alert(num+" is NOT OK!");
}else{
num=parseFloat(num);
alert (num+" is OK!")
}
}
//-->
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Entering decimal numbers only in javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|