httpRequest代码
Select Case e.Path
Case "test.htm"
Dim wb As New weui
wb.AddForm("","form1","test.htm")
With wb.AddInputGroup("form1","ipg1","列表项目")
.AddSelect("os","操作系统","|iOS|Windows|Andriod")
.AddSelect("bw","浏览器","|Chorme|[Edge]|Firefox|Internet Explorer")
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "submit")
End With
Dim str As String = "Windows"
wb.AppendHTML("<script src='./lib/test.js'></script>") '引入脚本文件
wb.AppendHTML("<script>display(""os"",""" & str & """)</script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
End Select
test.js 代码
function display(selectID, optionValue){
var all_options = document.getElementById(selectID).options;
for (i=0; i<all_options.length; i++){
if (all_options[i].innerHTML == optionValue) // 根据option标签的ID来进行判断 测试的代码这里是两个等号
{
all_options[i].selected = true;
}
}
};