三.web/lib/ajaxform.js代码如下:
function getmodelForm(){
setAjaxOptions('机型1','getmodel.htm','类型','系列',false);
setAjaxOptions('机型2','getmodel.htm','类型','系列',false);
}
function getchoose(){
var result=submitAjaxFileds("valid.htm","","类型","系列","机型1","机型2",false);
if(result=="OK"){
return true;
}
else{
showTopTips("toptip1",result,2500);
return false;
}
}
四.Httprequest数据如下所示:
Dim fl As String = "e:\baidu\web\" & e.path
If filesys.FileExists(fl)
Dim idx As Integer = fl.LastIndexOf(".")
Dim ext As String = fl.SubString(idx)
Select Case ext
Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
e.WriteFile(fl)
Return '这里必须返回
End Select
End If
Select Case e.path
Case "choose.htm","" '2.选择类型/系列/机型
Dim wb As New WeUI
wb.AddPageTitle("","choose","规格型号","***") '标题
wb.AddForm("","form1","getchoose.htm").Attribute="" '表单...接收此表单数据页面为:getchoose.htm...使用js脚本文件,判断是否有输入完整数据
With wb.AddInputGroup("form1","ipg1","选择规格型号") '列表
With .AddSelect("类型","类型","|" & DataTables("机器规格").SQLGetComboListString("类型")) 'GetComboListString是从后台所有数据中提取.
.Attribute = """ 'setAjaxOptions用于根据后台数据动态生成列表项目
End With
With .AddSelect("系列","系列","") '使用js脚本文件,在./web/lib文件夹中
.Attribute = ""
End With
.AddSelect("机型1","机型1","")
.AddSelect("机型2","机型2","")
End With
With wb.AddButtonGroup("form1","btg1",False) '按钮
.Add("btn1", "对比", "submit") '跳转至比对页面
.Add("btn2", "返回","", "./product.htm") '跳转到产品首页..也就是上一页
End With
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
Case "getmodel.htm" '3.系列/机型下拉列表
Dim vals As String
If e.PostValues.Count = 1 Then
vals = "|" & DataTables("机器规格").SQLGetComboListString("系列","类型 = '" & e.PostValues("类型") & "'")
ElseIf e.PostValues.Count = 2 Then '当选择<系统>框值时,机型1/机型2的下拉取值框作如下变动
Dim Filter As String = "类型 = '" & e.PostValues("类型") & "' And 系列 = '" & e.PostValues("系列") & "'"
vals = "|" & DataTables("机器规格").SQLGetComboListString("机型", Filter)
End If
e.WriteString(vals)
Case "getchoose.htm" '3.对已选择的机型进行对比
Dim wb As New WeUI
If e.PostValues.ContainsKey("类型") AndAlso e.PostValues.ContainsKey("系列") AndAlso e.PostValues.ContainsKey("机型1") AndAlso e.PostValues.ContainsKey("机型2") Then
e.WriteString("我要开始对比了!下面的不会写,无法产生资料:(")
' *****
' *****
' *****
Else
e.WriteString("数据不完整,无法对比.请您重新选择!")
End If
End Select