我有一个带有多个用户控件的 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>
我在每个用户控件中将此脚本用于带有树视图的 dropdownextender,这是用于“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;
}
但我注意到 scipt 仅适用于“ucEducationInfo”用户控件。我尝试更改用户控件的行,我认为这是因为用户控件位于页面末尾。我不擅长 javascript。怎么了?