Archive for July, 2007

JavaScript Programmer’s Reference When the String.match() method is (Web design tools)

Tuesday, July 31st, 2007

JavaScript Programmer’s Reference When the String.match() method is used, it returns an array as a result. If the match used a pattern that made only a single match (that is, the g attribute was not used) then the array returned will have this additional index property. The indexproperty will contain the character location within the original string where the match occurred. See also: Array.input, RegExp.exec(), String.match() Array.input (Property) A special property provided only when the array results from a string match. Availability: JavaScript 1.2 JScript 5.5 Internet Explorer 5.5 Netscape 4.0 Property/method value type: String primitive JavaScript syntax: -myArray.input When the String.match() method is used, it returns an array as a result. If the match used a pattern that made only a single match (i.e. the g attribute was not used) then the array returned will have this additional input property. The inputproperty will contain a copy of the original string that was searched. See also: Array.index, RegExp.exec(), String.match() Array.join() (Method) Concatenate array elements to make a string. the array is concatenated to form a string Availability: ECMAScript edition 2 JavaScript 1.1 JScript 3.0 Internet Explorer 4.0 Netscape 3.0 Netscape Enterprise Server 2.0 Opera 3.0 Property/method value type: String primitive JavaScript syntax: -myArray.join(aSeparator) Argument list: aSeparator A string to place between array elements as

A Array.constructor (Property) Array.constructor (Property) A reference (Make my own web site)

Tuesday, July 31st, 2007

A Array.constructor (Property) Array.constructor (Property) A reference to a constructor object. Availability: ECMAScript edition 2 JavaScript 1.1 JScript 3.0 Internet Explorer 4.0 Netscape 3.0 Property/method value type: Array constructor JavaScript syntax: -myArray.constructor The constructor is that of the built-in Array prototype object. You can use this as one way of creating arrays although it is more popular to use the new Array() technique. This property is useful if you have an object that you want to clone but you don’t know what sort of object it is. Simply access the constructor belonging to the object you have a reference to. Netscape provides constructors for many objects, virtually all of them in fact, even when it is highly inappropriate to do so. MSIE is far more selective and there are some occasions when you might wish for a constructor that MSIE does not make available. See also: Array.length, Array.prototype Cross-references: ECMA 262 edition 2 section 15.4.2 ECMA 262 edition 3 section 15.4.2 ECMA 262 edition 3 section 15.4.4.1 Array.index (Property) A special property provided only when the array results from a string match. Availability: JavaScript 1.2 JScript 5.5 Internet Explorer 5.5 Netscape 4.0 Property/method value type: Number primitive JavaScript syntax: -myArray.index

JavaScript Programmer’s (Web site design) Reference for(myIndex = 0; myIndex

Monday, July 30th, 2007

JavaScript Programmer’s Reference for(myIndex = 0; myIndex < myLength; myIndex++) { document.write("“); document.write(myIndex); document.write(”“); document.write(anArray[myIndex]); document.write(”“); } document.write(”

“) } See also: Array.prototype, String.concat() Cross-references: ECMA 262 edition 3 section 15.4.4.4 Array instance Array instance 0 A 1 B 2 C 3 D A1.concat(A2) A1 A1 A2 Array instance 0 A 1 B 2 C 3 D

A Array.concat() (Method) Array.concat() (Method) Concatenate arrays (Web hosting script)

Monday, July 30th, 2007

A Array.concat() (Method) Array.concat() (Method) Concatenate arrays together. Availability: Property/method value type: JavaScript syntax: Argument list: The result of this method is a new array consisting of the original array, plus the concatenation. The values that are passed to the method are added to the end of the array. If arrays are passed, they are flattened and their individual elements added. The method returns an array consisting of the original Array plus the concatenated values. If Array1 contains “AAA”, “BBB”, “CCC” and Array2 contains “000″, “111″, “222″, then the method call Array1.concat(Array2) will return an array with all the elements in a single collection. The original arrays will be untouched. Warnings: . The concat() method will flatten arrays that are passed as arguments. However, it will not recursively flatten multi-dimensional arrays. Example code: ECMAScript edition 3 JavaScript 1.2 JScript 3.0 Internet Explorer 4.0 Netscape 4.0 Netscape Enterprise Server 3.0 Array object -myArray.concat(someValues, …) someValues A sequence of values to concatenate onto the array See also: Aggregate type, Array index delimiter ([ ]), Array literal, Array(), Array(), Array.Class, Array.length, Array.prototype, Collection object, JavaArray object, JellyScript, Native object, Object object, String.split(), unwatch(), VBArray.toArray(), watch() Property JavaScript JScript N IE Opera NES ECMA Notes constructor 1.1 + 3.0 + 3.0 + 4.0 + 2 + - index 1.2 + 5.5 + 4.0 + 5.5 + - input 1.2 + 5.5 + 4.0 + 5.5 + - length 1.0 + 3.0 + 2.0 + 4.0 + - ReadOnly prototype 1.1 + 3.0 + 3.0 + 4.0 + 2 + ReadOnly, DontDelete, DontEnum Method JavaScript JScript N IE Opera NES ECMA Notes concat() 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + 3 + Warning join() 1.1 + 3.0 + 3.0 + 4.0 + 3.0 + 2.0 + 2 + - pop() 1.2 + 5.5 + 4.0 + 5.5 + 3.0 + 3 + - push() 1.2 + 5.5 + 4.0 + 5.5 + 3.0 + 3 + - reverse() 1.1 + 3.0 + 3.0 + 4.0 + 3.0 + 2.0 + 2 + - shift() 1.2 + 5.5 + 4.0 + 5.5 + 3.0 + 3 + - slice() 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + 3 + Warning sort() 1.1 + 3.0 + 3.0 + 4.0 + 3.0 + 2.0 + 2 + Warning splice() 1.2 + 5.5 + 4.0 + 5.5 + 3.0 + 3 + Warning toLocaleString() 1.5 + 5.5 + 6.0 + 5.5 + 3 + Warning toSource() 1.3 + 3.0 + 4.06 + 4.0 + - toString() 1.1 + 3.0 + 3.0 + 4.0 + 3.0 + 2.0 + 2 + Warning unshift() 1.2 + 5.5 + 4.0 + 5.5 + 3.0 + 3 + - valueOf() 1.1 + 3.0 + 3.0 + 4.0 + -

JavaScript Programmer’s Reference In (Web server type) JavaScript version 1.0, arrays

Saturday, July 28th, 2007

JavaScript Programmer’s Reference In JavaScript version 1.0, arrays were simple objects and had limited functionality, scarcely enough really to be called arrays. Some commentators argue that the functionality was so limited that they should be flagged as available from version 1.1 of JavaScript only. They were usually simulated by creating an instance of the Objectobject and using its named properties as if the object was an array. Much additional functionality was added for JavaScript version 1.1. JavaScript version 1.0 lacked the constructors and arrays had no special methods available. The ECMA standard enhances the functionality and Netscape 4 provides additional functionality. An instance of the class “Array” is created by using the new operator on the Array() constructor. At JavaScript version 1.2, arrays can be created with an Array literal as well. The new object adopts the behavior of the built-in prototype object through the prototype-inheritance mechanisms. All properties and methods of the prototype are available as if they were part of the instance. Note that the index and inputproperties are available only for arrays that are produced as the result of a RegExpmatch. They are not generally available in Arrays or Collections. An array is a collection of properties owned by an object and that can be accessed by name or by index position in the array. Because they are collected together and accessible as a set, they may be sorted into the order of the array. Arrayobjects give special treatment to property names, which are numeric values. These are used as an index value and will affect the value of the length property. The length supported depends on the platform, but is usually based on a 32 bit integer being used for addressing. That limits the range to 4 Billion array elements. Array objects implement the Put() internal function slightly differently from non-array based objects. The prototype for the Array prototype object is the Object prototype object. In the C language, an array is referred to as an aggregate type since it is made from a collection or aggregate of individual members. Warnings: . Although arrays were partially supported prior to JavaScript version 1.1, the support was not reliably or completely implemented. There was no way for the script developer to create and modify the arrays. Netscape 2 lacks any realistic array support even though Array objects were returned by some object properties. . The WebTV set top box limits the extent of the Arrayobjects to contain only 32,768 elements instead of the 4 Billion or so that is defined as the normal maximum. This is because WebTV uses 16 bit integers for addressing arrays rather than 32 bit integers.

A Array object (Object/core) Example code: // (Post office web site)

Friday, July 27th, 2007

A Array object (Object/core) Example code: See also: Array object Cross-references: ECMA 262 edition 3 section 11.1.4 O’Reilly JavaScript, The Definitive Guide ISBN 1-56592-392-8 page 46 Array object (Object/core) An object of the class “Array”. Availability: ECMAScript edition 2 JavaScript 1.1 JScript 3.0 Internet Explorer 4.0 Netscape 3.0 Netscape Enterprise Server 2.0 Opera 3.0 -myArray = Array -myArray = myVBArray.toArray() -myArray = new Array() -myArray = new Array(aLength) JavaScript syntax: -myArray = new Array(anItem1, anItem2, anItem3, …) aLength An optional initial length to set the array to. Argument list: anItemN A variable number of initial elements to insert into the array. Object properties: Object methods: constructor, index, input, length, prototype concat(), join(), pop(), push(), reverse(), shift(), slice(), sort(), splice(), toLocaleString(), toSource(), toString(), unshift(), valueOf() An array is basically an indexed collection of references to other objects or values.