javascript

bpzcxfmw  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(174)

我试着用vb.net完成一个外文网页

<select name="standardCode" class="form-control full-width" id="standardCode">
<option value="">Please select RSS</option>
<option value="510">Part1</option>
<option value="583">Part2</option>
</select>

<script>
        $("#saveAndContinueButton").on("click", function(){
            saveNames();
        });

        $("#standardCode").on("change", function (event){
            let standardCode = this.value;
            cleanSelect($("#version"));
        });
</script>

“click”事件可以通过简单的“.getelementbyid”(“saveandcontinuebutton”).click()触发。
但是下拉菜单不起作用。
我的代码可以在下拉列表中选择该项,但不会触发java。

Sub Drop_Down()
        Dim doc2 As IHTMLDocument2 = IEApp.Document
        Dim dropdown As IHTMLElement = doc2.all.item("standardCode")
        Dim dropdownItems As IHTMLElementCollection = dropdown.children
        For Each element As IHTMLElement In dropdownItems
            If element.innerText = "Part1" Then
                element.setAttribute("selected", "selected")
                Dim doc3 = DirectCast(IEApp.Document, IHTMLDocument3)
                Dim doc3el = DirectCast(doc3.getElementById("standardCode"), IHTMLElement3)
                doc3el.FireEvent("onchange", Nothing)
            End If
    Next

我没有更多的想法要解决。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题