Javascript |
Jquery |
Register an event |
|
<Asp: button id = "button" text ="Button"Runat =" server" Onclientclick = "javascript: clickevent ();"/> |
$ ("# <% = Button. clientid %> ").Click(Isclick ); $ ("# <% = Button. clientid %> ").Blur(Isblur ); Or $ ("# <% = Button. clientid %> ").Blur(Function (){ Isblur (); }); |
Get controlID |
|
Document. getelementbyid ('trremark ') |
$ ("# Trremark ") |
Get server controlsID |
|
Document. getelementbyid ('<% = button. clientid %> ') |
$ ("# <% = Button. clientid %> ") |
display and hide htmlelements |
|
document. getelementbyid ("TR "). style ("display", "inline"); document. getelementbyid ("TR "). style ("display", "NONE"); |
$ (" # TR "). show (); $ (" # TR "). hide (); $ (" # TR "). toggle (); |
Get value\Text |
|
Document. getelementbyid ("TXT"). Value Document. getelementbyid ("TXT"). innertext |
$ ("# <% = TXT. clientid %>"). Val () $ ("# <% = TXT. clientid %>"). Text () $ ("# <% = Dropdownlist. clientid %> Option: Selected"). Text () |
Array |
|
var arr = new array (); arr [0] =" "; arr [1] = B; arr [2] =" C "; |
var arr = [" A ", B," C "]; |
JudgmentArrayIs thereFalse |
|
For(VAR I =0; I <entryarray. length; I ++ ){ If (entryarray [I] == false ) { Flag =False; Break; } } If(Flag =False){ // Todo } |
If ($. inarray ("false", entryarray )! =-1 ){ // Todo } |
Determine whether the object isUndefined |
|
Typeof (document. getelementbyid ('trremark '))! = "Undefined" |
Typeof trremark! = 'Undefined' |
Load Style |
|
|
$ ("# <% = Button. clientid %>" ).css ("bordercolor", "Red "); |
Assign values to elements |
|
Document. getelementbyid ("textbox"). value = "1234 "; |
$ ("# Textbox"). Val ("1234 "); |
Indexof |
|
JSInclusion relationship UseIndexof ()Method If> = 0Otherwise, it does not contain VaR A = "testhelloword "; Document. Write (A. indexof ("hello ")); |
$ ("# Textbox"). Val (). indexof ("Hello") <0 |