index.htm情况:下面的index.htm代码,里面的wb.AddForm("","form" & bianh,"test.htm"),说明form表单是根据会员编号动态生成4条表单,执行后,页面能够正常显示。
test.htm情况:test.htm页面与index.htm相同(只是会员相应的编号、年龄等不同),同样根据会员编号动态生成4条表单
问题:点击index.htm页面底部的的“加载更多”按钮,将test.htm页面插入到index.htm页面,插入页面不成功?下述插入页面用的js代码,我感觉关键是下述js里面的红色form1,是不是因为"form" & bianh,没有form1呢?(bianh是“编号”,都是1000以上,max后+1的数字)
function tongji(){
var result = submitAjaxForm('form1','',false); ’这里被插入的test.htm页面,没有form1,是不是这个原因导致插入页面不成功的?
var p1 = document.getElementById("p1");
var p2 = document.getElementById("p2");
p1.innerHTML = p1.innerHTML + "<br/>" + p2.innerHTML;
p2.innerHTML = result;
//alert("OK");
//window.location.hash = "#p2";
}
以下是index.htm代码:
Dim e As RequestEventArgs = args(0) '首页
Select Case e.Path
Case "index.htm"
Dim wb As New weui
'msgbox(1)
Dim username As String = e.cookies("isj") '从cookie取会员手机号
'Dim huiydj As String '定义,会员等级
'msgbox(2)
Dim drs As List(of DataRow) '用于存放展示在首页的会员编号
Dim drr As DataRow '会员在"会员资料"表中的行
Dim xb As String '定义,性别
'msgbox(3)
Dim qr As String = e.cookies("querwdlxb") '定义,游客是否已经进入过"确认性别"页面 '"确认性别"页面增加了:e.AppendCookie("querwdlxb",queren) '确认游客已经进入了"确认性别"页面
'msgbox(4)
If username IsNot Nothing Then '如果cookie中,有会员手机号:取已登录会员的性别|会员等级
'msgbox(5)
drr = DataTables("会员资料").sqlFind("手机 = '" & username & "'") '查找会员所在的行
If drr IsNot Nothing Then
'msgbox(6)
xb = drr("性别")
'huiydj = drr("会员等级")
End If
End If
'msgbox(7)
If xb = "" AndAlso qr = "ok" Then '如果前面没有取得性别
For Each key As String In e.GetValues.Keys '取未登录会员性别
'msgbox(8)
If key = "sex" Then
xb = e.GetValues(key)
If xb = 1 Then
xb = "男"
msgbox("性别:" & xb)
e.AppendCookie("querxb",xb) '这个cookie,必须在登录后删除,这样才可以做到流程完整
ElseIf xb = 0 Then
xb = "女"
msgbox("性别:" & xb)
e.AppendCookie("querxb",xb) '这个cookie,必须在登录后删除,这样才可以做到流程完整
End If
End If
Next
End If
'msgbox(9)
If xb = "" Then '这里用来第一次之后,访问时,确认游客性别(从上一段代码生成的cookie中,取性别)
xb = e.cookies("querxb")
End If
'msgbox(10)
If xb = "" Then '性别,经过上述赋值,还是为空,跳转到index0.htm,进行性别确认
wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到:确认性别页面
e.WriteString(wb.Build) '生成网页
End If
'msgbox(11)
wb.DeleteCookie("querwdlxb")
'到这里必须删除,确认性别页面添加的cookie(这样,利于下次执行)
'msgbox(12)
If xb = "男" Then '如果会员女生,则显示男生
drs = DataTables("会员资料").SQLSelect("[性别] = '女'",4,"注册日期 DESC") '从订单表找,个人订单集合
Else '其他情况,显示男生
drs = DataTables("会员资料").SQLSelect("[性别] = '男'",4,"注册日期 DESC") '从订单表找,个人订单集合
End If
'msgbox(13)
For Each dr As DataRow In drs
'msgbox(13-1)
Dim zhansz As String = dr("展示照") '定义,年龄
Dim bianh As String = dr("会员编号") '定义,年龄
Dim nianl As String = dr("年龄") '定义,年龄
Dim xuel As String = dr("学历") '定义,学历
Dim huny As String = dr("婚姻状况") '定义,婚姻状况
Dim suozqx As String = dr("所在区县") '定义,所在区县
Dim suozshi As String = dr("所在市") '定义,所在市
Dim suozs As String = dr("所在省") '定义,所在省
'msgbox(14)
With wb.AddArticle("","ar" & bianh)
.AddImage("./images/zhanshi/" & zhansz)
msgbox("编号:" & bianh & "照片:" & zhansz)
.Attribute = "style='padding:0.5em;'"
End With
wb.AddForm("","form" & bianh,"test.htm")
'msgbox(15)
With wb.AddInputGroup("form" & bianh,"ipg" & bianh)
With .AddInput("xm" & bianh,"年龄","text")
.Value = nianl & "岁|" & xuel & "|" & huny
.Readonly= True
End With
With .AddInput("pw" & bianh,"城市","text") ' "'">"'" ,表达式留存
.Value = suozqx & ">" & suozshi & ">" & suozs
.Readonly= True
End With
End With
With wb.AddButtonGroup("form" & bianh,"btg" & bianh,False)
.Add("btn1" & bianh, "查看TA的资料", "submit")
End With
Next
wb.insertHTML("","<div id='p1' style='margin:0.5em'></div>") '插入一个div,用于显示服务器返回的 页面
wb.insertHTML("","<div id='p2' style='margin:0.5em'></div>")
wb.insertHTML("","<div></div>")
With wb.AddButtonGroup("","btg0", True)
.Add("btns", "加载更多").Attribute= ""
End With
wb.AppendHTML("<script src='./lib/ajaxform_tongji.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
End Select
[此贴子已经被作者于2017/4/9 10:11:41编辑过]