判断是否是小数的方法:12345function check(c){ var r= /^[+-]?[1-9]?[0-9]*\.[0-9]*$/ return r.test(c)} //它可以包含 + - 号,不需要的话,去掉 [+-]?
JS判断的编程如下:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>menu</title>
<style type="text/css">
</style>
<script type="text/javascript">
var num = 1.11
var reg = /.*\..*/
alert (reg.test(num))
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE HTML><html lang="en-US">
<head>
<meta charset="UTF-8">
<title>menu</title>
<style type="text/css">
</style>
<script type="text/javascript">
var num = 1.11
var reg = /.*\..*/
alert (reg.test(num))
</script>
</head>
<body>
</body>
</html>