1: Get all attributes of srcelement
FunctionT ()
{
VaRSTR = "";
For(Mm in window. event. srcelement)
STR + = mm + "=" + window. event. srcelement [mm] + "\ n"; // obtain all attributes of srcelement
Alert(STR );
}
2: Dynamic Output
Function T1 ()
{
VaR myvariable = "Hello there ";
Document. Write ("out this words ");
Document. Write (myvariable. Italics () + "<br/> ");
Document. Write (myvariable. tolowercase () + "<br/> ");
}
3: Array
Function T2 ()
{
VaR myvariable = "A, E, C, D ,";
VaR c = myvariable. substring (0, myvariable. Length-1 );
VaR stringarry = C. Split (",");
VaR I = 0;
For (I; I <stringarry. length; I ++)
{
Alert (stringarry [I]);
}
}
4. Obtain webpage Parameters
Function T3 ()
{
VaR urlparts = Document. url. Split ("? ");
VaR parameterparts = urlparts [1]. Split ("&");
VaR I;
For (I = 0; I <parameterparts. length; I ++)
{
VaR pairparts = parameterparts [I]. Split ("= ");
VaR pairname = pairparts [0];
VaR pairvalue = pairparts [1];
Alert (pairvalue );
}
}
// ==========Simple JS application in jquery Architecture============
// Obtain parameters
VaR selectid = "<% = request. querystring [" memberid "] %> ";
// Check whether it is empty
Function checkeditdata ()
{
If ($ ("# <% = textbox1.clientid %>"). Val () = "")
{
Alert ("Enter the user name ");
$ ("# <% = Textbox1.clientid %>"). Focus ();
}
// Use checkboxAjaxDelete cyclically
Function delrolein ()
{
VaR S = $ ("intput [@ checked]", "# checkbox1 ");
If (S. length> 0)
{
VaR v = "";
S. Each (function () {v = V + this. Value + ","});
// Self-executed Ajax loop deletion method;
}
Else
{
Alert ("select the role to be called out ");
}
}
// Add attributes to a server-side control
Funciton Xiao ()
{
VaR tempvalue = "58 ";
$ ("# <% = Linkbutton1.clientid %>"). ATTR ("href". Window. Location. href. Split ("? ") [0] + "? Ogid = "+ tempvalue );
}