问题看下面最后红色字体
'--index.htm部分代码-------------------------------------------------------------------------------------------------
*****
wb.AppendHTML("<script sr-c='./lib/getplace.js'></script>") '引入脚本文件
*****
’开始选择性别
Dim qr As String = e.cookies("querwdlxb") '定义,游客是否进入过"确认性别"页面(此cookie在"确认性别"页面创建,在本页删除)
Dim i As Integer '记录首页展示人数,即for each语句循环次数
For Each key As String In e.GetValues.Keys '取未登录游客性别 '如果前面已经弹出确认性别dlg1对话框,已经点击按钮确认了性别(dlg1代码在本页内!)
If key = "sex" Then
xb = e.GetValues(key)
If xb = 1 Then
xb = "男"
'msgbox("性别:" & xb)
e.AppendCookie("querxb",xb) '这个cookie,若用户登录后,在httprequest代码判断登录处,删除(已解决)
ElseIf xb = 0 Then
xb = "女"
'msgbox("性别:" & xb)
e.AppendCookie("querxb",xb) '这个cookie,若用户登录后,在httprequest代码判断登录处,删除(已解决)
End If
End If
Next
'msgbox(4)
If xb = "" Then '这里用来第一次之后,访问时,确认游客性别(从上一段代码生成的cookie中,取性别)
xb = e.cookies("querxb") '这个cookie在本页创建,若用户登录后,在httprequest代码判断登录处,删除(已解决)
End If
If username IsNot Nothing Then '如果cookie中,有会员手机号:取已登录会员的性别|会员等级(即会员已登录,覆盖上面的定义的xb,实际上登录时,cookie:querxb已经被删除了)
xb = e.cookies("ixb")
'huiydj = e.cookies("idj")
End If
If xb = "" Then '性别,经过上述赋值,还是为空,弹出确认会员性别对话框
With wb.AddDialog("","dlg1", "确认性别","您尚未登录,需要选择性别哦!")
.AddButton("btnNAN1","我是男生","/index.htm?sex=1") ’当第一次进入,不知道会员性别时,这里执行了
.AddButton("btnNV1","我是女生","/index.htm?sex=0") 点击按钮确认性别后,
'.Attribute = "style='padding:0.5em;'" 再次进入index链接是:***/index.htm?sex=1
End With
wb.AppendHTML("<script>show('dlg1')</script>")
e.WriteString(wb.Build) '生成网页
Return "" '必须的
End If
’开始定位城市
Dim chakshi As String
Dim queren As String '用于确认访问的城市 '从cityb.htm跳转到首页(因为不能保存cookie,所以用这样的方法,传递到首页,再保存为cookie)
Dim zdqueren As String '用于自动确认城市
If zdqueren = "" AndAlso queren = "" Then '如果自动确认城市和确认城市,都为空,则自动确认城市
wb.AppendHTML("<script>getLocation()</script>") ’这个js执行正常,后台跳转到getplace.htm取得会员定位的城市
e.WriteString(wb.Build) '生成网页
Return "" '必须的
End If
msgbox("执行了0") ’这里没有执行
For Each key As String In e.GetValues.Keys
If key = "chengshi" Then
queren = e.GetValues(key)
If queren <> "" Then '说明上个页面是cityb.htm(因为cityb.htm不能保存cookie,所以用这样的方法,传递到首页,再保存为cookie)
wb.AppendCookie("CHAKSHI",queren,43200)
End If
End If
If key = "zdchengshi" Then
zdqueren = e.GetValues(key)
If zdqueren <> "" Then '说明上个页面是getplace.htm(因为不能保存cookie,所以用这样的方法,传递到首页,再保存为cookie)
wb.AppendCookie("CHAKSHI",zdqueren,43200)
End If
End If
Next
msgbox("执行了1") ’这里没有执行
If drusername IsNot Nothing Then
chakshi = drusername("查看城市") '将会员所在城市赋值给查看城市
End If
If queren <> "" OrElse zdqueren <> "" Then '即有传递城市值cookie时,取cookie城市值
chakshi = e.Cookies("CHAKSHI") '将临时城市赋值给查看城市 '此cookie在临时城市页面(cityb.htm)生成,在httprequest事件删除
End If
If chakshi = "" Then '如果上述2次赋值后,依然为空,赋值连云港市
chakshi = "连云港市"
End If
Dim e As RequestEventArgs = args(0) '取得会员所在地
e.Resp
Dim wb As New weui
Dim shoujihao As String = e.Cookies("isj") '赋值手机号
Dim dr As DataRow = DataTables("会员资料").sqlFind("手机 = '" & shoujihao & "'")
Dim zdchengshi As String
msgbox(1)
Dim jingweidu As String = e.PlainText '如何将(longitude + "|" + latitude)分开及赋值?
Dim jingdu As Double = jingweidu.split("|")(0)
Dim weidu As Double = jingweidu.split("|")(1)
Dim ur As String = "http://api.map.baidu.com/geocoder/v2/?ak=SzsmhchTmRGyBw3SFl&output=json&location=" & jingdu & "," & weidu
Dim hc As new HttpClient(ur)
Dim jo = JObject.Parse(hc.GetData)
output.show(jo.Tostring)
msgbox(2)
If jo("status") = 0 Then
If dr IsNot Nothing Then '已经登录
dr("定位_省份")= jo("result")("addressComponent")("province")
dr("定位_城市")= jo("result")("addressComponent")("city")
dr("定位_区县")= jo("result")("addressComponent")("district")
msgbox(jo("result")("addressComponent")("province"))
msgbox(jo("result")("addressComponent")("city"))
msgbox(jo("result")("formatted_address"))
msgbox(jo("result")("addressComponent")("district"))
zdchengshi = dr("定位_城市")
msgbox(3)
dr.save
Else '没有登录
zdchengshi = jo("result")("addressComponent")("city")
msgbox(4)
End If
End If
msgbox(5) ’这里执行后,发现手机屏幕是空白的,浏览器链接是:***index.htm?sex=1,而不是***index.htm?zdchengshi=某城市
wb.InsertHTML("<meta http-equiv='Refresh' con-tent='0; u-rl=/index.htm?zdchengshi=" & zdchengshi & "'>")
e.WriteString(wb.Build) '生成网页