I believe many of my friends have encountered some problems! This once made me depressed for a while, that is to say, if a user control is used in another place, you must view the source file and find the ID of the space on the client.
One method I wrote is:
Function selectproduct (PARAM)
{
Ctl00_m_g_6e621127_5514_4beb_805a_cd87e5949b43_ctl00_callback1.callback (PARAM );
}
// Ctl00_m_g_6e621127_5514_4beb_805a_cd87e5949b43_ctl00_callback1 is the ID displayed by a client named callback1. different clients will display different IDs;
Later, I accidentally met a built-in property. clientid:
So it should be in the following form.
<SCRIPT type = "text/JavaScript">
// Image preloading
VaR img1 = new image ();
Img1.src = '../wpresources/sitemap/spinner.gif ';
Function selectproduct (PARAM)
{
<% = Callback1.clientid + ". Callback (PARAM)" %>;
}
</SCRIPT>
// Callback1.clientid is used to obtain the ID of callback1 displayed on the client. This increases the flexibility.
Reference Method:
<SCRIPT type = "text/JavaScript">
Function panelclick (sender, e ){
VaR messages = $ get ('<% = messages. clientid %> ');
Highlight (messages );
}
Function activetabchanged (sender, e ){
VaR currenttab = $ get ('<% = currenttab. clientid %> ');
Currenttab. innerhtml = sender. get_activetab (). get_headertext ();
Highlight (currenttab );
}
VaR highlightanimations = {};
Function highlight (EL ){
If (highlightanimations [El. uniqueid] = NULL ){
Highlightanimations [El. uniqueid] = ajaxcontroltoolkit. animation. createanimation ({
Animationname: "color ",
Duration: 0.5,
Property: "style ",
Propertykey: "backgroundcolor ",
Startvalue: "# ffff90 ",
Endvalue: "# ffffff"
}, El );
}
Highlightanimations [El. uniqueid]. Stop ();
Highlightanimations [El. uniqueid]. Play ();
}
Function togglehidden (value ){
$ Find ('<% = tabs. clientid %>'). get_tabs () [2]. set_enabled (value );
}
</SCRIPT>