Common prototype Methods
$ (), $ (), $ A (), $ F (), $ H (), $ R (), $ W ()
Try. These (), document. getelementsbyclassname ()
$ () Method
Syntax
$ (ID | element)-> htmlelement
$ (ID | element)...)-> [htmlelement...]
Description
If provided with a string, returns the element in the document with matching ID; Otherwise returns the passed element. takes in an arbitrary number of arguments. all elements returned by the function are extended with prototype Dom extensions.
Example
Function Foo (element ){
Element = $ (element );
}
$ () Method
Syntax
$ (Cssrule...)-> [htmlelement...]
Description
Takes an arbitrary number of CSS selectors (strings) and returns a document-order array of extended DOM elements that match any of them.
$ ('Div ')
//-> All divs in the document. Same as document. getelementsbytagname ('div ')!
$ ('# Contents ')
//-> Same as $ ('contents'), only it returns an array anyway.
$ ('Li. Faux ')
//-> All Li elements with class 'faux'
$ ('# Contents a [rel]')
//-> All links inside the element of ID "contents" with a rel attribute
$ ('A [href = "#"] ')
//-> All links with a href attribute of value "#" (eyeew !)
$ ('# Navbar li', '# sidebar li ')
//-> All links within the elements of ID "navbar" or "sidebar"
$ ()
$ A (iterable)-> actualarray
$ F () method
$ F (element)-> Value
<Body>
<Div id = "one" class = "foo"> single class name </div>
<Div id = "two" class = "foo bar Thud"> multiple class names </div>
<Ul id = "list">
<Li id = "item_one" class = "Thud"> list item 1 </LI>
<Li> list item 2 </LI>
<Li id = "item_two" class = "Thud"> list item 3 </LI>
</Ul>
</Body>
Document. getelementsbyclassname ('foo ');
//-> [Htmlelement, htmlelement] (div # One, div # Two)
Document. getelementsbyclassname ('thud ');
//-> [Htmlelement, htmlelement, htmlelement] (div # Two, Li # item_one, Li # item_two );
Document. getelementsbyclassname ('thud ', $ ('LIST '));
//-> [Htmlelement, htmlelement] (Li # item_one, Li # item_two)
Try. These () method
Gettransport: function (){
Return try. These (
Function () {return New XMLHttpRequest ()},
Function () {return New activexobject ('msxml2. xmlhttp ')},
Function () {return New activexobject ('Microsoft. xmlhttp ')}
) | False;
}