以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 关于weui 数值录入框的问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=146595) |
-- 作者:ap9709130 -- 发布时间:2020/2/27 11:48:00 -- 关于weui 数值录入框的问题 老师 我的代码如下: With wb.AddInputGroup("page2","ipg3","订单明细") With .AddInputCell("cp2") \'通过InputCell增加输入框 .AddLabel("lcp","产品名称",0) \'增加标签,0显示在左边 .AddInput("cpmc","text",1) .AddVcodeButton("cpcx","查询",2).Attribute= "" End With .AddInput("pack","包装规格","text").Readonly = True With .AddInput("js","件数","number") .Min = "0" End With .AddInput("sl","产品数量","number").Step = "0.0001" .AddInput("jg","销售价格","number").Step = "0.000000001" .AddInput("je","销售金额","number").Step = "0.01" End With With wb.AddButtonGroup("page2","qrz", False) \'水平排列 .Add("cjmx", "增加明细") .Add("qxmx", "取消明细") End With 但为什么 件数那里还是可以录入小数,还有金额 也可以录入超过2位的小数? 请看图 |
-- 作者:有点蓝 -- 发布时间:2020/2/27 13:35:00 -- 这种只是会在浏览器里出现一个提示,无法禁止输入小数点。 添加一个js文件,代码 function keyPress() { var keyCode = event.keyCode; if (keyCode == 109 || keyCode == 110 || keyCode == 229) { event.returnValue = false; } else{ event.returnValue = true; }
} 代码: Select Case e.Path Case "test.htm" Dim wb As New weui wb.AddForm("","form1","test.htm") With wb.AddInputGroup("form1","ipg1","数值输入") .AddInput("xm","姓名","text") With .AddInput("sl","年龄","number") .Min = "18" .Max = "60" .Placeholder = "年龄范围为18到60" .Attribute = "onKeyDown=\'keyPress()\'" End With .AddInput("dj","工资","number").Step = "0.01" End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "确定", "submit") End With wb.AppendHTML("<script src=\'./test.js\'></script>",True) e.WriteString(wb.Build) \'生成网页 End Select [此贴子已经被作者于2020/2/27 13:35:24编辑过]
|
-- 作者:ap9709130 -- 发布时间:2020/2/27 14:40:00 -- 老师 明白了.测试过. onchage 应该会好用些. 判断值能不能转成整数, 不能就变空. 这样更好用. 多谢老师指点!
|
-- 作者:有点蓝 -- 发布时间:2020/2/27 15:06:00 -- onchage处理不了 |