比如
Select Case e.Path
Case "test.htm"
Dim wb As New weui
wb.AddForm("","form1","test.htm")
With wb.AddInputGroup("form1","ipg1","订单明细")
With .AddSelect("province","产品名称","|"+DataTables("订单明细").GetComboListString("产品名称"))
.Attribute = "onchange=""setAjaxOptions('county','getCounties.htm','province',false)"""
End With
With .AddSelect("county","产品型号","")
.Attribute = "onchange='setCodes()'" '调用js函数
End With
End With
wb.AddPage("form1","p1") '增加两个page
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "submit")
End With
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
Case "getCounties.htm" '根据输入的产品名称,获取产品型号列表
Dim pps As String = DataTables("订单明细").GetComboListString("产品型号","产品名称='" & e.Values("province") & "'")
e.WriteString("|" & pps)
Case "getCodes.htm" '根据输入的产品名称和型号,获取图片和价格
Dim wb As New weui
With wb.AddInputGroup("","ipg1","图片")
Dim dr As DataRow = DataTables("订单明细").Find("产品名称='" & e.Values("province") & "' and 产品型号='" & e.values("county") & "'")
If dr IsNot Nothing Then
With .AddUploader("up1","",True)
.AllowAdd = False '关闭文件上传功能
.AddImage("./images/" & dr("图片") )
End With
.AddInput("postcode","价格","text").Value = dr("价格")
End If
End With
e.WriteString(wb.Build) '生成网页
End Select
js代码
function setCodes(){
var result= submitAjaxFileds('getCodes.htm','','province','county',false);
if(result){
document.getElementById("p1").innerHTML=result;
}
}