Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

isNumeric not recognising decimals

Status
Not open for further replies.

jy3

Programmer
Aug 20, 2003
6
IE
HI,
I am after writing an IsNumeric method but it is not recognising decimals. I will actually be entering code-levels eg, 2.2.60.2 etc so it is vital that it will recognise the decimals.

var qe = document.getinfo.elements["Code1"]
var q = qe.value
if (isNaN(q)||q.match(/^\W*$/)) {
alert( "The codelevel is not a number!")
qe.focus();
qe.select()
return false;
}

Any ideas on how to fix this??
Cheers
JY
 
<script language=javascript>
function checkifnumber(){
var oldstring=document.myform.textbox.value;
newString = oldstring.replace(&quot;.&quot;,&quot;&quot;);
if (isNaN(newString+0)) {
alert(&quot;invalid entry&quot;);
return false;
} }
</script>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top