找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 16467|回复: 1

[问题求助] [已解决]VBS检测文本输入框的输入,通过不同输入,得到不同信息

[复制链接]
发表于 2015-5-16 23:09:44 | 显示全部楼层 |阅读模式
检测文本输入框的输入,通过不同输入,得到不同信息,我点击submit没反应,
  1. <html>
  2. <head>
  3. <title>
  4. 测试哪里出问题了
  5. </title>
  6. <script language="vbscript">

  7. function jiance(snumber,imin,imax)
  8. if isnumeric(snumber) then
  9.    if instr(snumber,".")=0 then
  10.       if clng(snumber)>=imin and clng(snumber)<=imax then
  11.       jiance=""
  12.       else
  13.       msgbox jiance="please enter a number between "&imin&" and "&imax
  14.       end if
  15.    else
  16.    msgbox jiance="please enter an integer"
  17.    end if
  18. else
  19. msgbox jiance="please enter a number"
  20. end if
  21. end function

  22. sub form_onsubmit()
  23. dim s
  24. s=jiance(form.text.value,1,10)
  25. if s="" then
  26. msgbox "valid"
  27. else
  28. msgbox "try again"
  29. end if
  30. end sub

  31. </script>
  32. </head>
  33. <body>
  34. <form action="" name="form" method="post">
  35. <input type="text" name="text">
  36. <input type="submit" name="submit" value="submit">
  37. </form>
  38. </body>
  39. </html>
复制代码
发表于 2015-5-17 12:28:18 | 显示全部楼层
  1. <html>
  2. <head>
  3. <title>
  4. 测试哪里出问题了
  5. </title>
  6. <script language="vbscript">

  7. function jiance(snumber,imin,imax)
  8. if isnumeric(snumber) then
  9.    if instr(snumber,".")=0 then
  10.       if clng(snumber)>=imin and clng(snumber)<=imax then
  11.          jiance=""
  12.       else
  13.          jiance="please enter a number between "&imin&" and "&imax
  14.          msgbox jiance
  15.       end if
  16.    else
  17.       jiance="please enter an integer"
  18.       msgbox jiance
  19.    end if
  20. else
  21.    jiance="please enter a number"
  22.    msgbox jiance
  23. end if
  24. end function

  25. sub form_onsubmit()
  26. dim s
  27. s=jiance(form.text.value,1,10)
  28. if s="" then
  29.    msgbox "valid"
  30. else
  31.    msgbox "try again"
  32. end if
  33. end sub

  34. </script>
  35. </head>
  36. <body>
  37. <form action="" name="form" method="post">
  38. <input type="text" name="text">
  39. <input type="submit" name="submit" value="submit">
  40. </form>
  41. </body>
  42. </html>
复制代码
IE8测试通过

评分

参与人数 1技术 +1 收起 理由
c755731262 + 1 谢谢提醒

查看全部评分

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 18:22 , Processed in 0.012705 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表