Serial number |
Operation |
Category |
IE (6.0) |
Firefox (2.0) |
Mozilla (1.5) |
Current Browser |
Remarks |
1 |
"." |
Inherent attribute of access tag |
OK |
OK |
OK |
OK |
|
2 |
"." |
User-Defined attributes of access tags Eg: <input type = "checkbox"Myattr = "test"> |
OK |
No |
No |
OK |
Can be replaced by the getattribute function. |
3 |
OBJ. getattribute |
Inherent attribute of access tag |
OK |
OK |
OK |
OK |
|
4 |
OBJ. getattribute |
User-Defined attributes of access tags Eg: <input type = "checkbox"Myattr = "test"> |
OK |
OK |
OK |
OK |
|
5 |
Document. All |
Access all child elements of document Eg: Document. All |
OK |
OK |
No |
OK |
We recommend that you use the childnodes object or the getelementbyid function to perform the corresponding operation. Some people say that it cannot take the DIV element. The test result is OK. I don't know if there are other factors that will affect the test result. |
6 |
OBJ. All |
Access all child elements of non-document elements Eg: Document. getelementbyid ("mydiv"). All |
OK |
No |
No |
OK |
Same as above |
7 |
Getelementbyid () |
Obtain the element based on the element ID/name. If the element only sets the name attribute, the ID attribute is not set. |
OK |
No |
No |
OK |
Note: many elements do not have the name attribute. For example: TD, Div, span... |
8 |
Variable name = "" |
Implicit variable definition-define a new variable by appending a value to the variable name. |
OK |
OK |
OK |
OK |
Suggestion: to avoid the hassle of displaying the definition variables. Eg: var TMP; |
9 |
ID |
Directly call an object by ID Eg: test_result_1.innerhtml = "" |
OK |
OK |
No |
OK |
The eval () function is used to execute scripts. If you input the Object ID/name to the eval function, ie will also return the object reference. We recommend that you use document. getelementbyid (ID) to call Note: For this reason, the variables implicitly defined in IE cannot be the same as the ID/Name of the element in HTML. |
10 |
Name |
Directly call an object using name Eg: test_for_this_name.innerhtml = "" |
OK |
No |
No |
OK |
Same as above/cause 7 |
11 |
Name |
Special characters ("! ",". "," @ "," # "," $ "," <",...) Eg: Document. getelementsbyname ("AAAA! Page "); |
No |
OK |
OK |
No |
Other characters are not tested |
12 |
Tr. innerhtml = "" |
Set the internal HTML Script of the tr Element |
No |
OK |
OK |
No |
In IE, innerhtml of table and TR is a read-only attribute and cannot be directly set. You can set it through the insertrow/insertcell function. |
13 |
Cells Object Access |
Accessing the Tr cells object Premise: the tr element is the tr object after deletion, or the tr object before deletion copied with clonenode (true ). |
No |
OK |
OK |
Undefined |
You can insert a table and access it again, or use the getelementsbytagname function to access TD/Th. The deleted rows object does not exist. Other elements? |
14 |
(Index) |
Access Collection class objects Eg: document. Getelementsbytagname ("TD") (0) |
OK |
No |
No |
OK |
We recommend that you use the official operator "[]". |
15 |
OBJ. tostring () |
Obtain the object string "[object type name]". Eg: TD = "[object htmltablecellelement]" |
No |
OK |
OK |
No |
The tostring () function can be omitted and operated directly using objects. Note: "[object]" is returned in IE. |
16 |
OBJ. Class |
Defines the CSS style/style of an object. Eg: TD. Class = "xpstyle "; |
No |
OK |
No |
- |
Unable to write TestCode, There will be compilation errors! You can test it by using typeof (class) = NULL. It can be used in the code without exceptions. Class is used in HTML scripts, but classname should be used in JavaScript (class is the reserved keyword of JS ). Note: setattribute can be used to set the class value to the object, but it is not parsed as a CSS pattern. |
17 |
Const |
Reserved keywords, used to define constants. Eg: const hours = 24; |
No |
OK |
OK |
- |
Currently, only const is allowed. |
18 |
Input. Type |
Change input element type Eg: Input. type = "button "; |
No |
OK |
OK |
No |
Ie can be an initial input element type, but cannot be changed. If it must be changed, you can change the input element. |
19 |
OBJ. Children |
Set of child elements of the Access Object Eg: Document. Body. Children. length; |
OK |
No |
No |
OK |
You can use the childnodes object instead. |
20 |
Node. replacenode |
Replace a new Node object Eg: oldnode. replacenode (newnode ); |
OK |
No |
No |
OK |
You can replace it with the replaceChild function. |
21 |
Node. removenode |
Delete existing node objects Eg. oldnode. removenode (true ); |
OK |
No |
No |
OK |
You can use oldnode. parentnode. removechild (oldnode. |
22 |
Node. insertbefore |
Insert a Node object before the specified Node object Document. Body. insertbefore (newn, oldn ); |
OK |
OK |
OK |
OK |
|
23 |
OBJ. parentelement |
Parent element of the Access Object Eg: Document. Body. parentelement. ID; |
OK |
No |
No |
OK |
It can be replaced by a parentnode object. |
24 |
OBJ. childnodes. Length |
Returns the number of subnodes, which is the same as the number of tags. Eg: Document. Body. childnodes. length; |
OK |
No |
No |
OK |
In FF/Mozilla, blank spaces or line breaks are text nodes and are members of childnodes. You can avoid using node. getelementsbytagname. |
25 |
OBJ. Insertadjacentelement |
Insert an element to a specified position Eg: obj. insertadjacentelement ("beforebegin", button ); |
OK |
No |
No |
OK |
The insertadjacentelement function is similar to the insertadjacenttext function. You can use the insertbefore function to implement similar functions. |
26 |
Createelement () |
Creates an element of the specified type. Prerequisite: the element is an HTML Script. Eg: Document. createelment ("<input type = 'Radio 'value = 'test'> "); |
OK |
No |
No |
OK |
You can create an object element before setting properties, or directly add it to the corresponding location in the form of innerhtml.
|
27 |
Nodename |
Get the name of the object (TAG, attribute, textnode) node Eg: Name = obj. nodename; |
OK |
OK |
OK |
OK |
Some people say that there is a difference and they do not know it is a specific prerequisite. First, record the preparations. Alternative solution: If the node is a Tag Element, you can use the "tagname" value; if the node is an attribut object, you can use the "name" value; if the node is a textnode element, you can use nodetype = 3 to determine. |
28 |
Window. Event |
Get the current event object Eg: window. event; |
OK |
No |
No |
? |
You can actively input the event parameter to the Event Response Function. Eg: <a onclick = "javascript: showHelp (event)"> help </a> |
29 |
Event.tar get |
Get the trigger object of the event Eg: e.tar get; |
No |
OK |
OK |
? |
It can be used together with srcelement. It can actively input trigger object elements to the Event Response Function. Eg: <a onclick = "javascript: showHelp (this, event)"> help </a> |
30 |
Event. srcelement |
Get the trigger object of the event Eg: E. srcelement; |
OK |
No |
No |
? |
It can be used together with the target. It can actively pass in the trigger object to the Event Response Function. Eg: var OBJ = (e.tar get )? E.tar get: E. srcelemtn; |
31 |
Event object attributes |
The common attributes of the current three browsers: Altkey Button Cancelbubble Clientx Clienty Ctrlkey Screenx Screeny Shiftkey Type |
Altleft Behaviorcookie Behaviorpart Bookmarks Boundelements Contentoverflow Ctrlleft Dataworks Datatransfer Fromelement Keycode Nextpage Offsetx Offsety Propertyname Qualifier Reason Recordset Repeat Returnvalue Srcelement Shiftleft Srcfilter Srcurn Toelement Wheeldelta X Y
|
Bubbles Cancelable Currenttarget Detail Eventphase Explicitoriginaltarget Ischar Istrusted Layerx Layery Metakey Originaltarget Pagex Pagey Rangeoffset Rangeparent Relatedtarget Target Timestamp View Which |
Bubbles Cancelable Charcode Currenttarget Detail Eventphase Explicitoriginaltarget Ischar Keycode Layerx Layery Metakey Originaltarget Pagex Pagey Popupwindowuri Rangeoffset Rangeparent Relatedtarget Requestingwindowuri Target Timestamp View Which |
? |
There are too many differences between event objects, so you need to check them one by one. For more information, see the test area test at the bottom of the page. |
32 |
Register event |
Register with the attachevent Function |
OK |
No |
No |
- |
Careful Memory leakage !!! After the event is processed, you must call the detachevent function to destroy the event, and avoid repeated registration. |
33 |
Register event |
Addeventlistener function Registration |
No |
OK |
OK |
- |
|
34 |
Register event |
OBJ. onxxx = function ("response function name or code"); method registration Eg: BTN. onclick = function (doclick ); BTN. onclick = function ("return 1 + 1 ;"); |
OK |
OK |
OK |
- |
|
35 |
Destroy event |
Detachevent function destruction |
OK |
No |
No |
- |
|
36 |
Destroy event |
Removeeventlistener function destruction |
No |
OK |
OK |
- |
|
37 |
Destroy event |
OBJ. onxxx = NULL; method registration Eg: BTN. onclick = NULL; |
OK |
OK |
OK |
- |
|
38 |
Trigger event |
Fireevent Function Eg: BTN. fireevent ("onclick "); FF: VaR E = Document. createevent ("events "); E. initevent ("click", true, false ); Element. dispatchevent (Event) |
OK |
No |
No |
- |
|
39 |
trigger event |
dispatchevent function eg: var EVT = document. createevent ("mouseevents"); EVT. initmouseevent ("click", true, true); BTN. dispatchevent (EVT); |
NO |
OK |
OK |
- |
|