Archive for December, 2007

M Multiply then assign (*=) (Operator/assignment) Multiply (Web hosting resellers)

Monday, December 24th, 2007

M Multiply then assign (*=) (Operator/assignment) Multiply then assign (*=) (Operator/assignment) Multiply two operands storing the result in the first. A value to be multiplied and then assigned into anOperand2 Multiply the left operand by the right operand and assign the result to the left operand. This is functionally equivalent to the expression: anOperand1 = anOperand1 * anOperand2; Although this is classified as an assignment operator it is really a compound of an assignment and a multiplicative operator. The associativity is right to left. Refer to the operator precedence topic for details of execution order. The new value of anOperand1 is returned as a result of the expression. Warnings: . The operand to the left of the operator must be an LValue. That is, it should be able to take an assignment and store the value. Availability: ECMAScript edition 2 JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Netscape Enterprise Server version 2.0 Opera 3.0 Property/method value type: Number primitive JavaScript syntax: -anOperand1 *= anOperand2 anOperand1Argument list: A multiplier value See also: Assign value (=), Assignment expression, Assignment operator, Associativity, LValue, Multiplicative operator, Multiply (*), Operator Precedence Cross-references: ECMA 262 edition 2 section 11.13 ECMA 262 edition 3 section 11.13 1471

JavaScript Programmer’s Reference The * operator (Cheapest web hosting) performs multiplication,

Sunday, December 23rd, 2007

JavaScript Programmer’s Reference The * operator performs multiplication, producing the product of its operands. The multiplication is commutative. That means the operands being multiplied together can be arranged in any order without affecting the outcome as long as they are at the same precedence level. However, the multiplication may not always be associative in ECMAScript compliant interpreters due to finite precision in the evaluations. This means that placing parentheses around the operands may affect the outcome. For example (A * B) * C may not evaluate identically to A * (B * C) to associative artifacts but A * B * C should be identical to B * C* Abecause of commutation. The rules of floating point multiplication should be governed by the rules of IEEE 754 double- precision arithmetic. If either operand is NaN then the result will be NaN. The sign of the result is positive if both operands have the same sign, negative if the operands have different signs. Multiplication of an infinite value by zero results in NaN. Multiplication of infinity by infinity results in infinity. The sign is determined by the sign rules as normal. Multiplying infinity by a finite non-zero value results in a signed infinity. The sign is determined as normal. Otherwise, where neither an infinite value or NaNis involved, the product is computed and rounded to the nearest representable value. If the magnitude of the result is larger than the largest value the interpreter can cope with, an infinity of the appropriate sign is substituted. If the magnitude is too small to be represented, then a zero value is substituted. Note that internally, zero values can be negative or positive and the sign may affect the result of subsequent computations. The associativity is left to right. Refer to the operator precedence topic for details of execution order. See also: Associativity, Multiplicative operator, Multiply then assign (*=), Operator Precedence Cross-references: ECMA 262 edition 2 section 11.5.1 ECMA 262 edition 2 section 11.13 ECMA 262 edition 3 section 11.5.1 1470

M Multiply (*) (Dedicated web hosting) (Operator/multiplicative) Warnings: . The

Saturday, December 22nd, 2007

M Multiply (*) (Operator/multiplicative) Warnings: . The order of evaluation of the operands is described in the ECMA standard and a fully compliant implementation should evaluate from left to right. This means that the expression: . myFunctionA()* myFunctionB() . should evaluate myFunctionA() before myFunctionB()and any side effects of executing myFunctionA() will precede those for myFunctionB(). . However, you should test this and not rely on it being portable across implementations. . Beware of expressions like this: . 0 * myFunction() . Even though you may not have put the zero in as a constant, the operand on the left may evaluate to be zero. Some implementations may provide performance enhancements that depend on eliminating unnecessary computation. A zero multiplied by any other value will yield a zero. The function may never be executed. . If you really want myFunctionA(), myFunctionB()or myFunction() to be executed reliably and in a portable manner, you should evaluate them outside of the expression and assign their results to variables, which you can then use in the expression in their place. . There is a very marginal performance hit but the scripts will execute more reliably across a wider variety of platforms. Arithmetic operator, Associativity, Binary operator, Divide (/), Divide then assign (/=), Expression, Multiplicative expression, Multiply (*), Multiply then assign (*=), Operator, Operator Precedence, Remainder (%), Remainder then assign (%=) See also: Cross-references: ECMA 262 edition 2 section 11.5 ECMA 262 edition 3 section 11.5 Multiply (*) (Operator/multiplicative) Multiply one operand by another. Availability: ECMAScript edition 2 JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Netscape Enterprise Server version 2.0 Opera 3.0 Property/method value type: Number primitive JavaScript syntax: -anOperand1 * anOperand2 anOperand1 A value to be multiplied Argument list: anOperand2 The multiplier value 1469

JavaScript Programmer’s Reference Multiplicative expression (Definition) (Web server extensions) An expression

Saturday, December 22nd, 2007

JavaScript Programmer’s Reference Multiplicative expression (Definition) An expression containing a multiply or divide operator. Availability: Property/method value type: ECMAScript edition 2 Number primitive Multiplicative expressions use the multiplicative operators to yield a result by operating on two other values, which may themselves be nested. See also: Divide (/), Expression, Modulo, Multiplicative operator, Remainder (%) Cross-references: ECMA 262 edition 2 section 11.5 ECMA 262 edition 3 section 11.5 Multiplicative operator (Definition) A multiply or divide operator. Availability: Property/method value type: ECMAScript edition 2 Number primitive Multiplicative operators are those that require multiplication or division to evaluate their result. The following table lists all operators that are multiplicative and those, which are classified under other categories, which are also multiplicative, by implication: Operator Description % Remainder * Multiply / Divide *= Multiply and assign to an LValue /= Divide and assign to an LValue %= Remainder and assign to an LValue Operands that are used with multiplicative operators must have numeric values or be convertible using the valueOf() method. 1468

M Multi-line comment (Definition) Example code: // (My web server)

Friday, December 21st, 2007

M Multi-line comment (Definition) Example code: // An example shamelessly stolen from Wrox Instant JavaSscript // Create a 2×2 array and store an identity matrix in it. var matrix = new Array(2); matrix[0] = new Array(2); matrix[1] = new Array(2); matrix[0][0] = 1; matrix[1][0] = 0; matrix[0][1] = 0; matrix[1][1] = 1; See also: Array index delimiter ([]), Copying objects Cross-references: Wrox Instant JavaScript page 16 Multi-line comment (Definition) Comment blocks that span several lines of script source text. The character sequence /* introduces a multi-line comment. That comment block is terminated by the next occurrence of the */ character sequence. This means you cannot nest these comments within one another. That is arguably bad coding technique anyway. If you are used to C language you will most likely have used conditional compilation blocks controlled via the pre-processor. Most implementations of JavaScript do not support this, however one or two recent implementations, especially those that operate outside the context of a web browser, are beginning to introduce many C language-like facilities. One of those is the preprocessor with its macro directives. This is particularly useful to developers even though it is somewhat non-standard. Multiple line comments are replaced with a single line terminator during the interpretation phase. When the /* … */ does not have a line terminator inside, it is simply removed prior to interpretation of the remaining line content. Everything between the start and end of a multi-line comment is ignored. Warnings: . You cannot nest these kinds of comment delimiters within one another. See also: Comment, Comment (// and /* … */), Lexical convention, Line Cross-references: ECMA 262 edition 2 section 7.3 ECMA 262 edition 3 section 7.4 Wrox Instant JavaScript page 17 1467

JavaScript Programmer’s Reference MSIE (Web browser) An acronym (Space web hosting)

Thursday, December 20th, 2007

JavaScript Programmer’s Reference MSIE (Web browser) An acronym for the Microsoft web browser. See also: JScript version, Undocumented features, Web browser, Internet Explorer Multi-byte character (Definition) Character sets using more than 8 bits to represent a code point. JavaScript natively supports the Unicode character set. This means it is multi-byte character aware at the most fundamental level. Unicode and localization issues are related to one other and the one depends on the other. You cannot effectively localize an environment properly without multi-byte character sets. The extensions to ASCII to make it an international character set were workable but somewhat inconvenient. All manner of escape sequences were required and ultimately, it consumes more space than a multi-byte character would have. Unicode extended the width of the code points from 8 bits to 16. This allows the character set to increase from 256 to 65536 code points. To all intents and purposes, this is sufficient to encode every glyph and character share required by all languages world-wide. However, there may still be some limitations in the encoding used for Far-Eastern language variants. These may be addressed in the Unicode version 3.0 standard. See also: Character set, Localization, Unicode Multi-dimensional arrays (Definition) Useful techniques for manipulating matrices for math problems. Multi-dimensional arrays are not supported directly in JavaScript but you can construct them with arrays of arrays. An array can refer to another array with one of its elements. This means you can build multidimensional arrays, which are useful for working out 3D transformations. You probably wouldn’t implement a renderer or 3D modeller in JavaScript. However, you might have a Java applet that takes rotation values or perhaps a 3D viewing plugin of some sort that does the hard work. Warnings: . The arrays are not truly multi-dimensional and you must be careful to construct them properly and avoid damaging them inadvertently. 1466

M moveTo() (Method) moveBy() Delta X See (Web server type)

Thursday, December 20th, 2007

M moveTo() (Method) moveBy() Delta X See also: Window.onmove, Window.moveBy() moveTo() (Method) An alias for the window.moveTo() method. Availability: JavaScript 1.2 JScript 3.0 Internet Explorer 4.0 Netscape 4.0 Property/method value type: undefined -moveTo(aCoordX, aCoordY)JavaScript syntax: -myWindow.moveTo(aCoordX, aCoordY) aCoordX A position in pixels Argument list: aCoordY A position in pixels Offset X Offset Y See also: Window.onmove, Window.moveTo() 1465

JavaScript Programmer’s Reference MouseEvent.shiftKey (Property) A Boolean value (Web file server)

Wednesday, December 19th, 2007

JavaScript Programmer’s Reference MouseEvent.shiftKey (Property) A Boolean value that represents the state of the [shift] key. Availability: DOM level 2 JavaScript 1.5 Netscape 6.0 Property/method value type: Boolean primitive JavaScript syntax: N myMouseEvent.shiftKey When an event is being processed, you may want to know the state of the [shift] key on the keyboard. This Boolean property returns true when the [shift] key is pressed and false when it is not. This property reflects the state of the [shift]key at the instant when the event was triggered. The user may have released the key in the meantime so you should not assume that if the [shift] key was pressed earlier on that it is still pressed when the event handler is being executed. See also: Event.shiftKey Property attributes: ReadOnly. moveBy() (Method) An alias for the window.moveBy() method. Availability: JavaScript 1.2 JScript 3.0 Internet Explorer 4.0 Netscape 4.0 Property/method value type: undefined -moveBy(anOffsetX, anOffsetY)JavaScript syntax: -myWindow.moveBy(anOffsetX, anOffsetY) anOffsetX A distance in pixels Argument list: anOffsetY A distance in pixels 1464

M MouseEvent.screenX (Property) MouseEvent.screenX (Property) Mouse position (Web hosting service)

Tuesday, December 18th, 2007

M MouseEvent.screenX (Property) MouseEvent.screenX (Property) Mouse position relative to the screen display. DOM level 2 JavaScript 1.5 Netscape 6.0 Availability: Property/method value type: JavaScript syntax: You may need to know the position of the mouse relative to the screen display coordinates and not the browser window or objects within it. This property provides the horizontal coordinate of the mouse within the screen. Number primitive myMouseEvent.screenX N See also: Event.screenX Property attributes: ReadOnly. MouseEvent.screenY (Property) Mouse position relative to the screen display. DOM level 2 JavaScript 1.5 Netscape 6.0 Availability: Property/method value type: JavaScript syntax: Number primitive myMouseEvent.screenY N You may need to know the position of the mouse relative to the screen display coordinates and not the browser window or objects within it. This property provides the vertical coordinate of the mouse within the screen. See also: Event.screenY Property attributes: ReadOnly. 1463

JavaScript Programmer’s Reference MouseEvent.metaKey (Property) A Boolean value

Monday, December 17th, 2007

JavaScript Programmer’s Reference MouseEvent.metaKey (Property) A Boolean value that represents the state of the [meta] key. DOM level 2 JavaScript 1.5 Netscape 6.0 Availability: Property/method value type: JavaScript syntax: N Boolean primitive myMouseEvent.metaKey When an event is being processed, you may want to know the state of the [meta] key on the keyboard. This Boolean property returns true when the [meta] key is pressed and false when it is not. This property reflects the state of the [meta]key at the instant when the event was triggered. The user may have released the [meta] key in the meantime so you should not assume that if the [meta] key was pressed earlier on that it is still pressed when the event handler is being executed. Warnings: . The key may not always be labelled “META” on the keyboard. Property attributes: ReadOnly. MouseEvent.relatedTarget (Property) A related EventTarget object is referred to. DOM level 2 JavaScript 1.5 Netscape Navigator version 6.0 Availability: Property/method value type: JavaScript syntax: N EventTarget object myMouseEvent.relatedTarget The particular EventTargetreferred to depends on the event type and context. For example, the standard suggests this might be the object the mouse has just moved off when a mouseOver is being processed. The targetand relatedTargetproperty values would be exchanged vice versa if a mouseOut event were being processed. See also: EventTarget object Property attributes: ReadOnly. 1462