With ExWeUI.WebUI.AddTabsGroup("page1", "dianzu")
' .Attribute = ""
For Each drdz As DataRow In drdzs '遍历店铺生成tabs,并插入明细表
x = x + 1
diandm = drdz("yhdm")
dianmc = drdz("yhmc")
Dim sb As New StringBuilder
sb.AppendLine("<form action='shuruy_mxbiaoy.htm?diandm=" & diandm & "' enctype='multipart/form-data' method='post' id='" & diandm & "form1'>")
sb.AppendLine("<input id='" & diandm & "diandm' class='yincang' value='" & diandm & "'>")
sb.AppendLine("<input id='" & diandm & "dianmc' class='yincang' value='" & dianmc & "'>")
sb.AppendLine("<input id='" & diandm & "yhlx' class='yincang' value='" & yhlx & "'>")
sb.AppendLine("<input id='" & diandm & "xh' class='yincang' value='" & xh & "'>")
sb.AppendLine("<input id='" & diandm & "spdm' class='yincang' value='" & spdm & "'>")
sb.AppendLine("<input id='" & diandm & "lsj' class='yincang' value='" & lsj & "'>")
sb.AppendLine("<input id='" & diandm & "tijiao' class='yincang' value='" & tijiao & "'>")
sb.AppendLine("</form>")
sb.AppendLine("<script>document.getElementById('dianzu" & diandm & "').addEventListener('click',test2());</script>") '添加监听事件
wb.InsertHTML(sb.ToString)
With .AddPage("dianzu" & diandm, dianmc)
' wb.InsertHTML("page1", "<div id='d1' style='margin:0.5em'></div>") '插入一个div,用于显示服务器返回的明细表格数据
.C & diandm & "' style='margin:0.5em'>" & dianmc & Date.Now & "</div>" '插入一个div,用于显示服务器返回的明细表格数据
End With
Next
wb.InsertHTML(.BuildHtml)
End With
求助,,,以上代码中添加的监听事件不生效(js已添加到head中),,还有form 传递到服务器,服务器只能获取getvalues的值,postvalues中没有值
Dim yhdm As String = e.GetValues("diandm") '用户代码 ‘能正常获取
For Each a As String In e.PostValues.Keys ‘没有值
MessageBox.Show(a & ":" & e.PostValues(a))
Next
[此贴子已经被作者于2024/7/28 9:22:22编辑过]
页面生成后才能绑定事件
把script标签提交到头部,在js里使用document.querySelectorAll查询所有符合条件的标签绑定事件
谢谢蓝版,事件的问题解决了,
但是通过js var result = submitAjaxForm(diandm+"form1",'',false); 还是不能获取form中post的传递的参数值,只能获取form链接get传递的参数值,上面代码是哪里写错了吗
[此贴子已经被作者于2024/7/31 17:46:47编辑过]
有name属性才能提交
sb.AppendLine("<input id='" & diandm & "diandm' name='" & diandm & "diandm' class='yincang' value='" & diandm & "'>")