I am trying to execute a javascript function using VBA but without success.
I select an item in the list box.
My goal: refresh the result after item selected.
VBA:
IEdoc_NEW2.getElementById("native_dropdown_selected_size_name").selectedIndex = 1
Call IEdoc_NEW2.parentWindow.execScript("dummySubmitButton()", "JavaScript")
HTML:
<select name="dropdown_selected_size_name" tabindex="-1" class="a-native-dropdown" id="native_dropdown_selected_size_name" autocomplete="off" data-a-touch-header="Taille">
<option id="native_size_name_-1" value="-1" selected="" data-a-id="size_name_-1">Sélectionner</option>
<option class="dropdownAvailable" id="native_size_name_0" value="0,B07DHJZSB3" data-a-id="size_name_0" data-a-html-content="S" data-a-css-class="dropdownAvailable">
S </option>
<option class="dropdownUnavailable" id="native_size_name_1" value="1,B07DHKZM7P" data-a-id="size_name_1" data-a-html-content="M" data-a-css-class="dropdownUnavailable">
M
</option>
<option class="dropdownUnavailable" id="native_size_name_2" value="2,B07DHK697N" data-a-id="size_name_2" data-a-html-content="L" data-a-css-class="dropdownUnavailable">
L
</option>
</select>
JavaScript:
if (typeof(TwisterNonJs) == 'undefined') {
window.TwisterNonJs = {};
TwisterNonJs.handleDropDown = [];
}
TwisterNonJs.handleDropDown[1] = function() {
var twisterUpdateButton = "submit.twisterUpdateButton_1"
document.getElementById("dummySubmitButton").setAttribute("name", twisterUpdateButton);
document.forms['twister'].submit();
};
document.getElementById("native_dropdown_selected_size_name").onchange = function() {
TwisterNonJs.handleDropDown[1]();
};
But this isn't working.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…