Select Case e.Path
Case "test.htm"
If e.PostValues.count = 0 Then
Dim wb As New weui
wb.AddForm("","form1","test.htm")
With wb.AddInputGroup("form1","ipg1","客户资料")
.AddInput("姓名","姓名","Text") '前一个"姓名"是ID,后一个"姓名"是标题
.AddInput("年龄","年龄","number")
.AddInput("日期","日期","date")
.AddSelect("级别","级别","普通会员|高级会员|VIP会员")
.AddSwitch("停权","停权")
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "submit")
With .Add("btn2", "返回", "button")
.value = "btn2"
.Attribute = "onclick=""submitForm()"""
End With
End With
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
Else
Dim sb As New StringBuilder
sb.AppendLine("<meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=0'>")
sb.AppendLine("接收到的数据有:<br/><br/>")
For Each key As String In e.PostValues.Keys
sb.AppendLine(key & ":" & e.PostValues(key) & "<br/>")
Next
e.WriteString(sb.ToString)
End If
End Select
js
function submitForm(){
var result =submitAjaxFileds('test.htm','','姓名','btn2',false)
alert(result);
}