Dim wb As New WeUI '定义一个基于weui框架的网页生成器
Dim nms() As String
Select Case e.Path
Case "addnew.htm",""
wb.AddForm("","form1","page2.htm")
With wb.AddInputGroup("form1","ipg1","基本情况")
.AddSelect("类别","类别","普通|艺术|体育") .Attribute = "" '调用js函数,自动计算金额
.AddInput("普通","普通","number")
.AddInput("艺术","艺术","number")
.AddInput("体育","体育","number")
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btnok","确定")
End With
wb.InsertHTML("<script>document.getElementById(""艺术"").parentNode.parentNode.style.display = 'none';</script>")
wb.InsertHTML("<script>document.getElementById(""体育"").parentNode.parentNode.style.display = 'none';</script>")
wb.AppendHTML("<script src='./my.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
End Select
my.js
function show() {
if (document.getElementById("类别").value = "艺术") {
document.getElementById("艺术").parentNode.parentNode.style.display = 'block';
document.getElementById("体育").parentNode.parentNode.style.display = 'none';
} else if (document.getElementById("类别").value = "体育") {
document.getElementById("体育").parentNode.parentNode.style.display = 'block';
document.getElementById("艺术").parentNode.parentNode.style.display = 'none';
} else if (document.getElementById("类别").value = "普通") {
document.getElementById("艺术").parentNode.parentNode.style.display = 'none';
document.getElementById("体育").parentNode.parentNode.style.display = 'none';
}
}
问题是,如果选择艺术后,类别就不让在选择其它项了