以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 网页字符串分割求教 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=107124) |
-- 作者:baoxyang -- 发布时间:2017/9/21 16:49:00 -- 网页字符串分割求教 \'以下是动态生成网页的代码 Select Case e.Path Case "addnew.htm" Dim wb As New WeUI \'定义一个基于weui框架的网页生成器 wb.AddForm("","form1","addnew.htm") With wb.AddInputGroup("form1","ipg1","新增订单") .AddSelect("cp","产品","PD01|PD02|PD03|PD04|PD05") .AddInput("gy","雇员","text") .AddInput("kh","客户","text") .AddInput("dj","单价","number") .AddInput("zk","折扣","number") .AddInput("sl","数量","number") .AddInput("rq","日期","date") End With With wb.AddButtonGroup("form1","btg1",True) .Add("btnok","确定") End With e.WriteString(wb.Build) \'生成网页 Case "test.htm" Dim wb As new weui wb.AppendHTML("<script type=\'text/javascript\' src=\'/" & path & "/js/common.js\'></script>", True) wb.AppendHTML("<link rel=\'stylesheet\' href=\'/" & path & "/css/common.css\' Type=\'text/css\' charset=\'utf-8\'/>", True) wb.AddForm("","form1","test.htm") With wb.AddInputGroup("form1","ipg1","零件信息") .AddInput("gys","供应商编号","Text") .AddInput("ljh","零件号","Text") .AddInput("kxlh","空箱料号","Text") .AddInput("bzs","包装数","number") .AddInput("zdbm","自动编码","Text") .AddInput("gc","工厂","Text") End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "扫一扫", "button").Attribute = " & path & "/plus/barcode_scan.html\',true,true);""" End With \'\' wb.InsertHTML("<script>function scaned( t, r, f ) {plus.nativeUI.alert(\'扫描返回的信息如:\\n编码:\' + t + \'\\n内容:\' + r + \'\\n图片存放路径(在手机端):\' + f);}</script>") wb.InsertHTML("<script>function scaned( t, r, f ) {document.getElementById(\'gys\').value=r;}</script>") 我想实现function scaned( t, r, f ) 中变量r值,按“—”分割成6个字符串,并赋值到以上6个输入框的值,请教如何实现?谢谢指点!! e.WriteString(wb.Build) End Select
|
-- 作者:有点甜 -- 发布时间:2017/9/21 18:09:00 -- var ary = r.split("-"); document.getElementById(\'gys\').value=ary[0]; document.getElementById(\'ljh\').value=ary[1];
参考 http://www.w3school.com.cn/jsref/jsref_split.asp
[此贴子已经被作者于2017/9/21 18:11:54编辑过]
|
-- 作者:baoxyang -- 发布时间:2017/9/22 8:32:00 -- var ary = r.split("-"); document.getElementById(\'gys\').value=ary[0]; document.getElementById(\'ljh\').value=ary[1]; 以上实现代码如何在HttpRequest 窗口编写代码来实现,谢谢指点! |
-- 作者:有点甜 -- 发布时间:2017/9/22 8:40:00 -- wb.InsertHTML("<script>function scaned( t, r, f ) {var ary = r.split("-");document.getElementById(\'gys\').value=ary[0];document.getElementById(\'ljh\').value=ary[1];}</script>")
http://www.foxtable.com/mobilehelp/scr/0061.htm
|