我有一个包含多个用户控件的aspx页面。 页面结构如下:
<asp:Content ID="Content2" ContentPlaceHolderID="chpMainBody" runat="server">
<en:ProfileInfo ID="ucProfileInfo" runat="server" />
<br />
<en:WorkingExperienceInfo ID="ucWorkingExperienceInfo" runat="server" />
<br />
<en:TechnicalInfo ID="ucTechnicalInfo" runat="server" />
<br />
<en:EducationInfo ID="ucEducationInfo" runat="server" />
</asp:Content>
我在每个带有树形下拉框的用户控件中使用此脚本,这是针对“ucEducationInfo”用户控件的。
<script type="text/javascript">
var DDE4;
var DDE5;
function pageLoad() {
DDE4 = $find('<%= dde_CountryUniversity.ClientID %>');
DDE5 = $find('<%= dde_UniversityMajors.ClientID %>');
DDE4._dropWrapperHoverBehavior_onhover();
DDE5._dropWrapperHoverBehavior_onhover();
$get('<%= pnl_CountryUniversity.ClientID %>').style.width = $get('<%= txt_CountryUniversity.ClientID %>').clientWidth;
$get('<%= pnl_UniversityMajors.ClientID %>').style.width = $get('<%= txt_UniversityMajors.ClientID %>').clientWidth;
if (DDE4._dropDownControl) {
$common.removeHandlers(DDE4._dropDownControl, DDE4._dropDownControl$delegates);
}
if (DDE5._dropDownControl) {
$common.removeHandlers(DDE5._dropDownControl, DDE5._dropDownControl$delegates);
}
DDE4._dropDownControl$delegates = {
click: Function.createDelegate(DDE4, ShowMe),
contextmenu: Function.createDelegate(DDE4, DDE4._dropDownControl_oncontextmenu)
}
DDE5._dropDownControl$delegates = {
click: Function.createDelegate(DDE5, ShowMe),
contextmenu: Function.createDelegate(DDE5, DDE5._dropDownControl_oncontextmenu)
}
$addHandlers(DDE4._dropDownControl, DDE4._dropDownControl$delegates);
$addHandlers(DDE5._dropDownControl, DDE5._dropDownControl$delegates);
}
function ShowMe() {
DDE4._wasClicked = true;
DDE5._wasClicked = true;
}
但我注意到脚本仅适用于“ucEducationInfo”用户控件。我尝试更改用户控件的行,但我认为这是因为用户控件位于页面末尾。我不擅长JavaScript。有什么问题吗?