This auxiliary function library is an example of beginning JavaScript with Dom scripting and Ajax, but it is from the master of Christian Heilmann. I think it is worth learning from these new users.> Click here for download <
The following node refers to the document node, which is generally obtained through methods such as document. getelementsbytagname; TXT refers to the string;
Function |
Parameter description |
| Init () |
Initialize this function library |
| Lastsibling (node) |
Obtain the last sibling of a node (not a text node) |
| Firstsibling (node) |
Obtain the first brother of a node. |
| Gettext (node) |
Get Text in A node |
| Settext (node, txt) |
Set the text in the node to txt |
| CreateLink (to, txt) |
Construct a <A> label whose href is to and whose text content is txt |
| Createtextelm (ELM, txt) |
Construct an elm tag whose text content is txt |
| Closestsibling (node, direction) |
Obtain the closest brother of a node. If ction is set to 1, it indicates the following brother. If it is set to-1, it indicates the previous brother. |
| Initdebug () |
Initialize the debugging environment |
| Setdebug (Bug) |
Show bug |
| Stopdebug () |
Stop debugging |
| Getkey () |
Obtain the key value |
| Gettarget (E) |
Obtain event targets |
| Stopbubble (E) |
Stop bubbling |
| Stopdefault (E) |
Stop default action |
| Cancelclick (E) |
Cancel |
| Addevent :( elm, evtype, FN, usecapture) |
Add an evtype event to Elm. The processing function is fn. |
| Cssjs (A, O, C1, C2) |
A can have four values: swap, add, remove, and check. O is the object, and c1 and c2 are the two CSS class names. |
| Safariclickfix () |
Fixed safari's explanation of stopdefault (E) |
Here is a demo of applying this library in this book, which is also taken from this book.