判断表单中添加是否数字的JS与VBS代码
作者: 佚名 来源: Linux 宝库 点击: 日期: 2006-11-24
-->1.用javascript判断 [isNaN()] JS代码: <script language="javascript"> function check(formname){ if (isNaN(formname.price.value)){ alert('请输入数字'); formname.price.focus(); return false; } alert('是数字,通过'); return true; } </script> 调用: <form name="form1" method="post" action="" onsubmit="check(this)"> <input type="text" name="price"> <input type="submit" name="Submit" value="提交"> </form>2.用VBscript判断[isnumeric()] 跟上面的类似,用isnumeric()函数即可 <script language=vbscript> sub isnum(param) if not isnumeric(param) then msgbox("请输入数字") end if end sub </script>
【文章评论 】
【收藏本文 】
【推荐好友 】
【打印本文 】
【论坛讨论 】
相关文章:
文章评论: (条)
责任编辑:一分 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。