gpt4 book ai didi

javascript - 将我的 jquery 与 onclick 事件混合,该事件也与 SelectedIndexChanged 事件相关

转载 作者:行者123 更新时间:2023-11-28 10:26:22 27 4
gpt4 key购买 nike

问题是没有发生回发。我注意到,如果我返回 true,情况就不会是这样..但是有不确定的结果,所以我不知所措。任何帮助表示赞赏!

          <DropDownList ID="ddlS1" runat="server" onclick = "checkHighDegreeCompliance(this, 1);" SelectedIndexChanged = "ddlS1_SelectedIndexChanged" AutoPostBack="true" >

这是加载后实际页面上的标记

<select name="rptrSection1$ctl00$rptrSection2$ctl00$ddlS2" class="DDLSelector2 SDropDown IsNormal" id="rptrSection1_ctl00_rptrSection2_ctl00_ddlS2" style="width: 200px;" onchange="checkHighDegreeCompliance(this, 2);setTimeout('__doPostBack(\'rptrSection1$ctl00$rptrSection2$ctl00$ddlS2\',\'\')', 0)">

这是 JavaScript

function checkHighDegreeCompliance(obj, sectionNum)
{
var parDdl = $(obj);
var parCompLev = parDdl.attr('selectedIndex');
var pnlDiv = parDdl.parents('.Section');
var ddls = pnlDiv.find('.DDLSelector' + (sectionNum + 1));
ddls.each(function ()
{
var childDDL = $(this);
var childComLev = childDDL.attr('selectedIndex');
if (childComLev > parCompLev)
{
parDdl.attr('selectedIndex', childComLev);
}
if (sectionNum < 4)
{
checkHighDegreeCompliance(childDDL, ++sectionNum);
}
});
}

最佳答案

尝试在 onclick 事件之前使用 return 关键字

 <DropDownList ID="ddlS1" runat="server" onclick = "return checkHighDegreeCompliance(this, 1);" SelectedIndexChanged = "ddlS1_SelectedIndexChanged" AutoPostBack="true" >

如果它不起作用,请告诉我。

关于javascript - 将我的 jquery 与 onclick 事件混合,该事件也与 SelectedIndexChanged 事件相关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4190022/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com