<html>
<head>
<script language= "JavaScript">
function ckdec() {
var refstring = /\./g; //sets ref for char to be searched for
var mystrg = document.form1.testval.value;
if (mystrg.search(refstring) > -1) { // if search returns found value > -1
alert ("you have a decimal point!" }
else { alert ("you did not enter a decimal point!"}
}
</script>
</head>
<body>
<form name="form1">
<input type="text" name="testval" size="15" value="enter a num">
<input type="button" value="click to test" onClick="ckdec();">
</form>
</body
</html>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.