InsertHTML
之前介绍的AppendHTML,用于在Head区或Body区的结束位置追加代HTML代码。
如果需要在当前位置插入HTML代码,请使用InsertHTML,语法:
InsertHTML(Content)
InsertHTML(ParentId,Content)
Content: 要插入的内容。
ParentId: 父容器ID,如果是顶层对象,可以不设置。
一个例子
HttpRequest事件代码:
Select
Case e.Path
Case "test.htm"
Dim
wb As New
WeUI
wb.InsertHTML("<h3
align='center' style='margin-top:5px'>用户登录</h3>")
wb.AddForm("","form1","test.htm")
With wb.AddInputGroup("form1","ipg1")
.Attribute =
"style='margin-top:5px'"
.AddInput("xm","户名","text")
.AddInput("pw","密码","password")
End With
With
wb.AddButtonGroup("form1","btg1",True)
.Add("btn1",
"确定",
"submit")
End With
e.WriteString(wb.Build)
End
Select
下图是通过手机访问的效果,标题“用户登录”四个字是通过InsertHTML方法插入的: