我有一个下拉菜单,单击该菜单将关闭,进入下一页如何停止?现在,我要菜单打开被单击的链接,因为在链接上单击该页面正在打开,菜单在母版页面上
<button class="dropdown-btn" style="border: thin groove #000000; background:url(images/Banner_Top_Main.png); width: 180px;" >
<img src="images/masters.png" style="margin-left:-4px;" />   Masters
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-container">
<button class="dropdown-btn" style="border: thin groove #000000; line-height:20px; width: 180px; background-color:#82CAFF;" > Assets
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-container">
<a href="AssetTypesSetup.aspx" style="border: thin groove #000000; line-height:20px; border-bottom:0px; background-color:#00BFFF;">Asset Types Setup </a>
<a href="AssetLocationSetup.aspx" style="border: thin groove #000000; line-height:20px; border-bottom:0px; background-color:#00BFFF;">Asset Location Setup </a>
</div>
</div>
这是打开和关闭的Java脚本
<script type="text/javascript">
var dropdown = document.getElementsByClassName("dropdown-btn");
var i;
for (i = 0; i < dropdown.length; i++) {
dropdown[i].addEventListener("click", function () {
this.classList.toggle("active");
var dropdownContent = this.nextElementSibling;
if (dropdownContent.style.display === "block") {
dropdownContent.style.display = "none";
} else {
dropdownContent.style.display = "block";
}
});
}
</script>