- W3C DOM Core:
Due to the nature of the WordPress web log software, i will attempt to organize this reference in a hierarchical manner– therefore, this Top-Level page has its own child-pages (see web log Page navigation). Each of those sub-pages which are listed as a Method should contain a
<dl>element in which the The
<dt>field will indicate the title of that Method. Where applicable, the title shown there will be a hyperlink to the W3C DOM Core reference2
Cursory Look: Definitions in Disarray
Disclaimer: as this reference has been compiled as i’m going along, learning the language syntax and how to use it , i apologize that much of it may not be thoughtfully formatted for your viewing convenience. i intend to re-format the document in the future (in particular, the items listed below, and in the “Sub-Pages” navigable via the pages menu).
- innerHTML (a DOM thing?)
innerHTML sets or gets all of the markup and content within a given element.
var markup = element.innerHTML;element.innerHTML = markup;
markupis a string that contains the element’s content (including child elements) as raw HTML. For example,
// HTML: // <div id="d"><p>Content</p> // <p>Further Elaborated</p> // </div>d = document.getElementById("d");dump(d.innerHTML); // the string "<p>Content</p><p>Further Elaborated</p>" // is dumped to the console window
Though not actually a part of the W3C DOM specification, this property provides a simple way to completely replace the contents of an element. For example, the entire contents of the document body can be deleted by:
document.body.innerHTML = "";
// Replaces body content with an empty string.
The innerHTML property of many types of elementsâ€”including BODY or HTMLâ€”can be returned or replaced. It can be used to view the source of a page that has been modified dynamically:
NOTE: developer.mozilla.org Example ommitted here. Please visit the source page for the complete text
As there is no public specification for this property, implementations differ widely. For example, when text is entered into a text input, IE will change the value attribute of the input’s innerHTML property but Gecko browsers do not.
It should never be used to write parts of a tableâ€”W3C DOM methods should be used for thatâ€”though it can be used to write an entire table or the contents of a cell.
DOM Level 0. Not part of any standard.
- String Concatenation(1)
In addition to the comparison operators, which can be used on string values, the concatenation operator (
+) concatenates two string values together, returning another string that is the union of the two operand strings. For example,
"my " + "string"returns the string
The shorthand assignment operator
+=can also be used to concatenate strings. For example, if the variable
mystringhas the value “
alpha“, then the expression
mystring += "bet"evaluates to “
alphabet” and assigns this value to
typeofoperator is used in either of the following ways:
typeofoperator returns a string indicating the type of the unevaluated operand.
operandis the string, variable, keyword, or object for which the type is to be returned. The parentheses are optional.
Suppose you define the following variables:
var myFun = new Function("5+2") var shape="round" var size=1 var today=new Date()
typeofoperator returns the following results for these variables:
typeof myFun is object typeof shape is string typeof size is number typeof today is object typeof dontExist is undefined
- :: next description ::
- Special Operators:(1)
- Conditional « ?: »
condition ? expr1 : expr2
An expression that evaluates to
Expressions with values of any type.
true, the operator returns the value of
expr1; otherwise, it returns the value of
expr2. For example, to display a different message based on the value of the
isMembervariable, you could use this statement:
document.write ("The fee is " + (isMember ? "$2.00" : "$10.00"))
- :: special op … ::
- :: special definition … ::
- Operator Precedence(1)
The table below is an exact copy(1) of the Operator Precedence Table found at Mozilla.org
In accordance with relevant discussion, this table was reversed to list operators in decreasing order of priority.
Operator type Individual operators member .  call / create instance () new negation/increment ! ~ - + ++ – typeof void delete multiply/divide * / % addition/subtraction + - bitwise shift << >> >>> relational < <= > >= in instanceof equality == != === !== bitwise-and & bitwise-xor ^ bitwise-or | logical-and && logical-or || conditional ?: assignment = += -= *= /= %= <<= >>= >>>= &= ^= |= comma ,
Table 3.1: Operator precedence
A more detailed version of this table, complete with links to additional details about each operator, may be found in the Reference section.
the W3C Document Object Model Core reference: [ http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113 ]