js代码
function tongji(){
var result = submitAjaxForm('form1','',false);
document.getElementById("p1").innerHTML=result;
onload();
}
function dynaActiveSheet(){
var r = table1.rows[table1.rowSel].cells[0].innerHTML;
var c = table1.rows[0].cells[table1.colSel].innerHTML;
var result = sendAjaxText(r + "," + c, "image.htm","",false);
document.getElementById("p2").innerHTML=result;
}
httprequest代码
Select Case e.Path
Case "test.htm"
Dim wb As New weui
wb.AddForm("","form1","tongji.htm")
With wb.AddInputGroup("form1","ipg1","销售统计")
.AddSelect("水平分组","水平分组","|产品|客户|雇员").Attribute= "onchange= 'tongji()'"
.AddSelect("垂直分组","垂直分组","|产品|客户|雇员").Attribute= "onchange= 'tongji()'"
.AddSelect("统计列","统计列","数量|金额")
End With
'With wb.AddButtonGroup("form1","btg1",True)
' .Add("btn1", "统计", "button").Attribute= "onclick= 'tongji()'"
'End With
wb.AppendHTML("<div id='p1' style='margin:0.5em'></div>") '插入一个div,用于显示服务器返回的 页面
wb.AppendHTML("<div id='p2' style='margin:0.5em'></div>") '插入一个div,用于显示服务器返回的 页面
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
e.WriteString(wb.Build)
Case "tongji.htm"
Dim wb As New weui
If e.PostValues.ContainsKey("垂直分组") AndAlso e.PostValues.ContainsKey("水平分组") AndAlso e.PostValues.ContainsKey("统计列") Then
Dim b As New CrossTableBuilder("统计表1",DataTables("订单"))
b.HGroups.AddDef(e.PostValues("水平分组"))
b.VGroups.AddDef(e.PostValues("垂直分组"))
b.Totals.AddDef(e.PostValues("统计列"))
With wb.AddTable("","Table1")
.CreateFromDataTable(b.Build(True))
.AfterSelChange = "dynaActiveSheet()"
End With
Else
wb.InsertHTML("请按输入分组列和统计列!")
End If
e.WriteString(wb.Build)
Case "image.htm"
Dim ary = e.PlainText.split(",")
msgbox("查找得到产品【" & ary(0) & "】的图片路径")
e.WriteString("<img src='./images/001.jpg'>")
End Select
[此贴子已经被作者于2017/8/1 11:59:46编辑过]