Workarounds Available:
Areas Affected:
Javascript 1.2 new Functions
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | // "function" is any function name
function_name.arguments.length() |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Table of Contents
captureEvents, getSelection, handleEvent, releaseEvents, resizeTo, resizeBy, scrollTo, scrollBy, routeEvent, screen, scrollbars, innerHeight, innerWidth, locationbar, menubar, outerHeight, outerWidth, pageXOffset, pageYOffset, personalbar, toolbar, disableExternalCapture, enableExternalCapture, moveBy, moveTo, print, stop, home, statusbar, titlebar, back
Area Affected
Microsoft's objects:
document's properties: bgColor, charset, activeElement, aLinkColor,
BODY, cookie, defaultCharset, domain, expand, fgColor, fileCreatedDate,
fileModifiedDate, fileSize, lastModified, linkColor, location, parentWindow,
protocol, readyState, selection, TITLE, uniqueID, URL, vlinkColor
document's colletions: all, anchors, children, embeds, forms,
frames, images, links, scripts, styleSheets
document's methods: attachEvent, clear, close, createElement,
createStyleSheet, detachEvent, elementFromPoint, execCommand, open, queryCommandEnabled,
queryCommandIndeterm, queryCommandState, queryCommandSupported, queryCommandValue,
recalc, write, writeln.
document's events: onclick, ondblclick, ondrag, ondragend, ondragenter,
ondragleave, ondragover, ondragstart, ondrop, onhelp, onkeydown, onkeypress,
onkeyup, onmousedown, onmousemove, on mouseout, onmouseover, onmouseup,
onpropertychange, onreadystatechange
window's properties: name, clientInformation, closed, complete,
defaultStatus, dialogArguments, dialogHeight, dialogLeft, dialogTop, dialogWidth,
document, event, external, frames, history, length, location, navigator,
offscreenBuffering, opener, parent, returnValue, screen, screenLeft, screenTop,
self, status, top
window's methods: alert, attachEvent, blur, clearInterval, clearTimeout,
close, confirm, detachEvent, execScript, focus, moveBy, moveTo, navigate,
open, prompt, resizeBy, resizeTo, scroll, scrollBy, scrollTo, setInterval,
setTimeout, showHelp, showModelDialog
window's events: onbeforeunload, onblur, onerror, onfocus, onhelp,
onload, onresize, onunload.
Netscape's document object:
document's properties: alinkColor, anchors, applets, bgColor,
cookie, domain, embeds, fgColor, formName, forms, images, lastModified,
layers, linkColor, links, plugins, referrer, title, URL, vlinkColor.
document's methods: captureEvents, close, getSelection, handleEvent,
open, releaseEvents, routeEvent, write, writeln.
document's events: onClick, onDblClick, onKeyDown, onKeypress,
onKeyUp, onMouseDown, onMouseUp
window's properties: closed, defaultStatus, document, frames,
history, innerHeight, innerWidth, length, location, locationbar, menubar,
name, opener, outerHeight, outerWidth, pageXOffset, pageYOffset, parent,
personalbar, scrollbars, self, status, statusbar, toolbar, top, window
window's methods: alert, back, blur, captureEvents, clearInterval,
clearTimeout, close, confirm, disableExternalCapture, enableExternalCapture,
find, focus, forward, handleEvent, home, moveBy, moveTo, open, print, prompt,
releaseEvents, resizeBy resizeTo, routeEvent, scroll, scrollBy, scrollTo,
setInterval, setTimeout, stop
window's events: onBlur, onDragDrop, onError, onFocus, onLoad,
onMove, onResize, onUnload
CSS Properties
Font and Text Properties: fontFamily, fontSize, fontStyle, fontVariant,
fontWeight, font, letterSpacing, lineHeight, wordSpacing, textAlign, textDecoration,
textIndent, textTransform, verticalAlign
Colors and Background Properties: color, backgroundAttachment,
backgroundColor, backgroundImage, backgroundPosition, backgroundRepeat,
background
Box/Layout Properties: borderBottomColor, borderLeftColor, borderRightColor,
borderTopColor, borderColor, borderBottomStyle, borderLeftStyle, borderRightStyle,
borderTopStyle, borderStyle, borderBottomWidth, borderLeftWidth, borderRightWidth,
borderTopWidth, borderWidth, borderBottom, borderLeft, borderRight, borderTop,
border, clear, float, marginBottom, marginLeft, marginRight, marginTop,
margin, paddingBottom, paddingLeft, paddingRight, paddingTop, padding
Positioning Properties: clop, height, left, overflow, position,
top, visibility, width, zIndex
Other Properties: display, cursor, listStyleImage, listStylePosition,
listStyleType, listStyle
To use this library, you need to include the file, http://www.insidedhtml.com/positioning/dhtmlLib.js,
in your script as follows:
<SCRIPT SRC="http://www.insidedhtml.com/positioning/dhtmllib.js"
LANGUAGE="Javascript"></SCRIPT>
Areas Affected:
Javascript 1.2 Function - String Object
Javascript 1.1 | Need to store the ISO Latin-1 character set into an array and then do a table lookup to convert the characters to index in the character set. |
Javascript 1.0 | Need to store the ISO Latin-1 character set into an array and then do a table lookup to convert the characters to index in the character set. Since Javascript 1.0 does not have an array constructor, you'll need to look up the array script workaround to do this. |
JScript 3.0 | This method exists on the String object. |
JScript 2.0 | Need to store the ISO Latin-1 character set into an array and then do a table lookup to convert the characters to index in the character set. |
JScript 1.0 | Need to store the ISO Latin-1 character set into an array and then do a table lookup to convert the characters to index in the character set. |
VBScript 3.0 | ' CharCodeAt ("ABCDE",3)
results 67 (ascii value of C)
Function CharCodeAt (str,pos) CharCodeAt = Asc(mid(str,pos,pos+1)) End Function |
Areas Affected:
Javascript 1.2 new Functions
Javascript 1.1 |
<HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- // This Script uses setTimeout() and clearTimeout() to simulate // JavaScript 1.2 functions: setInterval() and clearInterval() var timerID = null // ID needed to stop the Timeout var timerRunning = false var nNum = 0 ; var nInterval = 500; // milliseconds function stopCount(){ if(timerRunning) clearTimeout(timerID); timerRunning = false; } function startCount(){ // Make sure the Count is stopped stopCount(); ShowCount( nInterval ); } // This function calls itself recursively to simulate setInterval() // Notice the interval setting, i, is passed twice // Once as a parameter for next ShowCount(), and another time as // the parameter for setTimeout(). function ShowCount(i){ nNum ++; document.Count.face.value = nNum; timerID = setTimeout("ShowCount(" + i +")",i) timerRunning = true } function OnClick() { if( timerRunning ) { stopCount(); document.Count.button_name.value = "Start Counter"; } else { startCount(); document.Count.button_name.value = "Stop Counter"; } } //--> </SCRIPT> </HEAD> <BODY> <FORM NAME="Count" onSubmit="0"> <INPUT TYPE="text" NAME="face" SIZE=12 VALUE =""> <INPUT TYPE=button NAME="button_name" VALUE="Start Counter" onclick="OnClick()"> </FORM> </BODY> |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Functions - RegExp Object
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Function - Array Object
Javascript 1.1 |
arr1 = new Array( 1, 2, 3 ); arr2 = new Array( 4, 5, 6 ); var NewArr = new Array( 1 ); NewArr = ConcatJS11( arr1, arr2 ); document.write( NewArr ); function ConcatJS11( arr1, arr2 ) { nTotalLength = arr1.length + arr2.length; arr3 = new Array( nTotalLength ); // Copy arr1 into arr3 for( i = 0; i < arr1.length; i++ ) { arr3[ i ] = arr1[ i ]; } // Copy arr2 into arr3 for( i = 0; i < arr2.length; i++ ) { arr3[ i + arr1.length ] = arr2[ i ];} return arr3; } //end ConCatJS11 |
Javascript 1.0 | function makeArray(n) {
for ( var i=1; i<n; i++ ) { this[i]=0 } return this } var arr1 = makeArray(3);
function ConcatJS10(arr1,arr2) {
|
JScript 3.0 | var a, b, c;
a = new Array(0,1,2,3,4); b = new Array(5,6,7,8,9); c = a.concat(b); |
JScript 2.0 | Use Javascript 1.0 or Javascript 1.1 workaround. |
JScript 1.0 | Use Javascript 1.0 or Javascript 1.1 workaround. |
VBScript 3.0 | dim list1(9)
dim list2(9) dim NewArr() Sub Concat (list1,list2)
counter = 0
|
Areas Affected:
Javascript 1.2 Function - String Object
Javascript 1.1 | function strConcat (str1, str2) {
return str1 + str2 } |
Javascript 1.0 | function strConcat (str1, str2) {
return str1 + str2 } |
JScript 3.0 | var a, b, c;
a = new Array(0,1,2,3,4); b = new Array(5,6,7,8,9); c = a.concat(b); |
JScript 2.0 | function strConcat (str1, str2) {
return str1 + str2 } |
JScript 1.0 | function strConcat (str1, str2) {
return str1 + str2 } |
VBScript 3.0 | Function Concat (str1,str2)
Concat = str1 & str2 End Function |
Areas Affected:
Javascript 1.2 Functions
Javascript 1.1 | // arr = source array from which the element will be deleted.
// index = the element that will be deleted. 1 <= index <= // arr.length function arrDelete(arr,index) { return arr.slice(0,index-1).concat(arr.slice(index,arr.length));} |
Javascript 1.0 | Since the array constructor is not supported, the Array workaround can be used. With this structure in mind, modifying the Javascript 1.1 delete workaround (above) should be simple. |
JScript 3.0 | Javascript 1.1 workaround will be the same. |
JScript 2.0 | Javascript 1.1 workaround will be the same. |
JScript 1.0 | Javascript 1.0 workaround will be the same. |
VBScript 3.0 | ' arr = source array where the index starts at 0.
' 0 <= index <= UBound(arr)-1 Function arrDelete (arr,index) redim NewArray (UBound(arr) - 1) dim counter counter = 0
|
Areas Affected:
Javascript 1.2 Functions
Javascript 1.1 | while (expr) { stmts; } |
Javascript 1.0 | while (expr) { stmts; } |
JScript 3.0 | while (expr) { stmts; } |
JScript 2.0 | while (expr) { stmts; } |
JScript 1.0 | while (expr) { stmts; } |
Areas Affected:
Javascript 1.2 Event Object
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Function - RegExp Object
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Signed Scripts
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Functions
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Function - String Object
Javascript 1.1 | See Javascript 1.0 workaround |
Javascript 1.0 | function fromCharCodeJS10 (CharCode) {
return "&#" + CharCode; } |
JScript 3.0 | fromCharCode ( ) |
JScript 2.0 | See Javascript 1.0 workaround |
JScript 1.0 | See Javascript 1.0 workaround |
VBScript 3.0 | chr(CharCode), where 0 <= CharCode <= 255 |
Areas Affected:
Javascript 1.2 new Functions
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Table of Contents
$1, $2, $3, $4, $5, $6, $7, $8, $9, input,
$_, multiline, $*, lastMatch, $&, lastParen, $+,
leftContext, $`, rightContext, $'
Areas Affected:
Javascript 1.2 Regular Expression Variables
Javascript 1.1 | RegExp Property - No Workaround exists |
Javascript 1.0 | RegExp Property - No Workaround exists |
JScript 3.0 | Same as Javascript 1.2 code |
JScript 2.0 | RegExp Property - No Workaround exists |
JScript 1.0 | RegExp Property - No Workaround exists |
Areas Affected:
Javascript 1.2 Functions - Navigator Object
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Layer's Properties: above, background, bgColor, below, clip.bottom,
clip.height, clip.left, clip.right, clip.top, clip.width, document, left,
name, pageX, pageY, parentLayer, siblingAbove, siblingBelow, src, top,
visibility, zIndex
Layer's Methods: captureEvents, handleEvent, load, moveAbove,
moveBy, moveTo, moveToAbsolute, releaseEvents, resizeBy, resizeTo, routeEvent.
Layer's Events: onBlur, onFocus, onLoad, onMouseOut, onMouseOver.
IFrame's Properties: accessKey, align, dataFld, dataSrc, frameBorder,
frameSpacing, hspace, id, lang, language, marginHeight, marginWidth, name,
noResize, scrolling, src, style, tabIndex, title, vspace, innerHTML, innerText,
isTextEdit, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth,
outerHTML, outerText, parentElement, parentTextEdit, recordNumber, sourceIndex,
style, tagName, uniqueID
IFrame's Methods: attachEvent, blur, contains, detashEvent,
focus, getAttribut, insertAdjacentHTML, insertAdjacentText, removeAttribute,
scrollIntoView, setAttribute
Targeting Layers: http://www.insidedhtml.com/tips/contents/ts10/page1.asp
Areas Affected:
Javascript 1.2 Functions - Regular Expression
Javascript 1.1 | Method of the String Object using Regular Expressions only supported in Javascript 1.2 - No Workaround exists. |
Javascript 1.0 | Method of the String Object using Regular Expressions only supported in Javascript 1.2 - No Workaround exists. |
JScript 3.0 | Same as Javascript 1.2 code |
JScript 2.0 | Method of the String Object using Regular Expressions only supported in Javascript 1.2 - No Workaround exists. |
JScript 1.0 | Method of the String Object using Regular Expressions only supported in Javascript 1.2 - No Workaround exists. |
VBScript 3.0 | No Workaround exists |
Table of Contents
OnMouseDown, OnMouseMove, OnMouseUp, OnKeyUp, OnKeyPress, OnKeyDown, OnDragDrop, OnDblClick, OnMove, OnResize, screenX, screenY
Areas Affected:
Events, Event Handler, Event Model
Microsoft's Event Model:
event object's properties: altKey, button, cancelBubble, clientX, clientY,
ctrlKey, dataFld, dataTransfer, fromElement, keyCode, offsetX, offsetY,
propertyName, reason, recordset, returnValue, screenX, screenY, shiftKey,
srcElement, srcFilter, toElement, type, x, y.
Microsoft's Events: onabort, onafterupate, onbeforecopy, onbeforecut,
onbeforepaste, onbeforeunload, onbeforeupdate, onblur, onbounce, oncellchange,
onchange, onclick, oncopy, oncut, ondataavailable, ondatasetchanged, ondatasetcomplete,
ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart,
ondrop, onerror, onerrorupdate, onfilterchange, onfinish, onfocus, onhelp,
onkeydown, onkeypress, onkeyup, onload, onlosecapture, onmousedown, onmousemove,
onmouseout, onmouseover, onmouseup, onpaste, onpropertychange, onreadystatechange,
onreset, onresize, onrowenter, onrowexit, onrowsdelete, onrowsinserted,
onscroll, onselect, onselectstart, onstart, onsubmit, onunload.
Netscape's Event Model:
event object's properties: data, height, layerX, layerY, modifiers,
pageX, pageY, screenX, screenY, target, type, which, width
Netscape's Events: onAbort, onBlur, onChange, onClick, onDblClick,
onDragDrop onError, onFocus, onKeyDown, onKeyPress, onKeyUp, onLoad, onMouseDown,
onMouseMove, onMouseOut, onMouseOver, onMouseUp, onMove, onReset, onResize,
onSelect, onSubmit, onUnload
Microsoft:
1. Link
2. Layer
3. document
4. window
5. default handler
Netscape:
1. Window
2. document
3. layer
4. link
5. default handler
Microsoft uses an event bubbling model. Event bubbling is a process
in which the object associated with where the event happened receives the
event first. This object then choose to process the event or pass
it along to its parent object.
NN4 uses an event capturing model, the opposite of an event bubbling
model. Rather than events being generated by the bottommost object in the
hierarchy, then bubbled up, events in the event capturing model are generated
at the top of the object hierarchy and then fall through to events lower
in the hierarchy. A limited number of page elements can generate
and process events. For example, onMouseOver is handled only images and
links.
To write scripts that will work in both browsers, don't use the feature of passing any events to parent event handlers, since the passing order is reversed in the two browsers. Instead, handle each event in a single function. Also, use only the events defined for the Netscape browser, since those will work in both.
References
1) Bubble Power: Event Handling in Internet Explorer 4.0 http://www.microsoft.com/workshop/author/script/ie4event.asp
2) Dynamic HTML and The New Event Models http://www.dhtmlzone.com/articles/eventmodels.html
3) Cross Browser Dynamic HTML http://www.dhtmlzone.com/articles/dhtml.html
Areas Affected:
Javascript 1.2
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | The most common means of getting user information in IE
is through:
Window.ClientInformation() |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
VBScript 3.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 new Functions
Example:
The following code displays the myFish array before and after removing its last element. It also displays the removed element:
myFish = ["angel", "clown", "mandarin", "surgeon"];document.writeln("myFish
before: " + myFish);
popped = myFish.pop();
document.writeln("myFish after: " + myFish);
document.writeln("popped this element: " + popped);
This example displays the following:
myFish before: ["angel", "clown", "mandarin", "surgeon"]
myFish after: ["angel", "clown", "mandarin"] popped this element: surgeon
Javascript 1.1 | //returns a new array of arr.length-1 with last element
removed.
function PopJS11(arr) { if (arr.length <=1) { return new Array (); } var newarr = new Array(arr.length-1);
|
Javascript 1.0 | Since the array constructor is not supported, the Array workaround can be used. With this structure in mind, modifying the Javascript 1.1 pop workaround (above) should be simple. |
JScript 3.0 | Use Javascript 1.1 workaround |
JScript 2.0 | Use Javascript 1.1 workaround |
JScript 1.0 | Use Javascript 1.0 workaround |
Areas Affected:
Javascript 1.2 Signed Scripts
Example:
reading preference
navigator.preference(pref);
setting preference
navigator.preference(pref, setting);
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 new Functions
Example:
The following code displays the myFish array before and after adding
elements to its end. It also displays the last element added:
myFish = ["angel", "clown"];
document.writeln("myFish before: " + myFish);
pushed = myFish.push("drum", "lion");
document.writeln("myFish after: " + myFish);
document.writeln("pushed this element last: " + pushed);
This example displays the following:
myFish before: ["angel", "clown"]
myFish after: ["angel", "clown", "drum", "lion"] pushed this
element last: lion
Javascript 1.1 | //returns a new array of arr.length+1 with 'data' appended.
function PushJS11(arr, data) { arr[arr.length] = data; return arr; } |
Javascript 1.0 | Since the array constructor is not supported, the Array workaround can be used. With this structure in mind, modifying the Javascript 1.1 push workaround (above) should be simple. |
JScript 3.0 | Use Javascript 1.1 workaround |
JScript 2.0 | Use Javascript 1.1 workaround |
JScript 1.0 | Use Javascript 1.0 workaround |
VBScript 3.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Regular Expressions
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Function - String Object
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.0 Tainted
Example:
window.location.search = "?qt=ben+jerry&col=WW&Search.x=45&Search.y=9"
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Functions
Javascript 1.1 |
<HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- // This Script uses setTimeout() and clearTimeout() to simulate // JavaScript 1.2 functions: setInterval() and clearInterval() var timerID = null // ID needed to stop the Timeout var timerRunning = false var nNum = 0 ; var nInterval = 500; // milliseconds function stopCount(){ if(timerRunning) clearTimeout(timerID); timerRunning = false; } function startCount(){ // Make sure the Count is stopped stopCount(); ShowCount( nInterval ); } // This function calls itself recursively to simulate setInterval() // Notice the interval setting, i, is passed twice // Once as a parameter for next ShowCount(), and another time as // the parameter for setTimeout(). function ShowCount(i){ nNum ++; document.Count.face.value = nNum; timerID = setTimeout("ShowCount(" + i +")",i) timerRunning = true } function OnClick() { if( timerRunning ) { stopCount(); document.Count.button_name.value = "Start Counter"; } else { startCount(); document.Count.button_name.value = "Stop Counter"; } } //--> </SCRIPT> </HEAD> <BODY> <FORM NAME="Count" onSubmit="0"> <INPUT TYPE="text" NAME="face" SIZE=12 VALUE =""> <INPUT TYPE=button NAME="button_name" VALUE="Start Counter" onclick="OnClick()"> </FORM></BODY> |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 new Functions
Example:
The following code displays the myFish array before and after removing its first element. It also displays the removed element:
myFish = ["angel", "clown", "mandarin", "surgeon"];
document.writeln("myFish before: " + myFish);
shifted = myFish.shift();
document.writeln("myFish after: " + myFish);
document.writeln("Removed this element: " + shifted);
This example displays the following:
myFish before: ["angel", "clown", "mandarin", "surgeon"]
myFish after: ["clown", "mandarin", "surgeon"]
Removed this element: angel
Javascript 1.1 | function ShiftJS11(arr) {
if (arr.length <=1) { return new Array (); } var newarr = new Array();
|
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Function - String Object
slice does not alter the original array, but returns a new "one level deep" copy that contains copies of the elements sliced from the original array. Elements of the original array are copied into the new array as follows: If a new element is added to either array, the other array is not affected.
Example:
In the following example, slice creates a new array, newCar, from myCar. Both include a reference to the object myHonda. When the color of myHonda is changed to purple, both arrays reflect the change.
<SCRIPT LANGUAGE="JavaScript1.2">
//Using slice, create newCar from myCar.
myHonda = {color:"red",wheels:4,engine:{cylinders:4,size:2.2}}
myCar = [myHonda, 2, "cherry condition", "purchased 1997"]
newCar = myCar.slice(0,2)
//Write the values of myCar, newCar, and the color of myHonda
// referenced from both arrays.
document.write("myCar = " + myCar + "<BR>")
document.write("newCar = " + newCar + "<BR>")
document.write("myCar[0].color = " + myCar[0].color + "<BR>")
document.write("newCar[0].color = " + newCar[0].color + "<BR><BR>")
//Change the color of myHonda.
myHonda.color = "purple"
document.write("The new color of my Honda is " + myHonda.color + "<BR><BR>")
//Write the color of myHonda referenced from both arrays.
document.write("myCar[0].color = " + myCar[0].color + "<BR>")
document.write("newCar[0].color = " + newCar[0].color + "<BR>")
</SCRIPT>
Javascript 1.1 |
function myStringSlice( str1, begin, end ) { // check number of arguments passed into the function if( myStringSlice.arguments.length < 2 ) { return null; } else if( myStringSlice.arguments.length == 2 ) { end = str1.length; } // deal with negative and large values of 'begin' and 'end' if( end < 0 ) { end = str1.length + end; } else if( end > str1.length ) { end = str1.length; } begin = ( begin < 0 ) ? 0 : begin; // assert data passed in are valid if( str1.length == 0 || // empty String begin >= str1.length ||// invalid begin index end <= begin || // invalid end index end == 0 // invalid end index ) { return null; } str2 = ""; for( i = begin, j = 0; i < end; i++, j++ ) { str2 += str1.charAt( i ); } return str2; } |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 new Functions
Example:
The following script illustrate the use of splice:
<SCRIPT LANGUAGE="JavaScript1.2">
myFish = ["angel", "clown", "mandarin", "surgeon"];
document.writeln("myFish: " + myFish + "<BR>");
removed = myFish.splice(2, 0, "drum");
document.writeln("After adding 1: " + myFish);
document.writeln("removed is: " + removed + "<BR>");
removed = myFish.splice(3, 1)
document.writeln("After removing 1: " + myFish);
document.writeln("removed is: " + removed + "<BR>");
removed = myFish.splice(2, 1, "trumpet")
document.writeln("After replacing 1: " + myFish);
document.writeln("removed is: " + removed + "<BR>");
removed = myFish.splice(0, 2, "parrot", "anemone", "blue")
document.writeln("After replacing 2: " + myFish);
document.writeln("removed is: " + removed);
</SCRIPT>
This script displays:
myFish: ["angel", "clown", "mandarin", "surgeon"]
After adding 1: ["angel", "clown", "drum", "mandarin", "surgeon"]
removed is: undefined
After removing 1: ["angel", "clown", "drum", "surgeon"]
removed is: mandarin
After replacing 1: ["angel", "clown", "trumpet", "surgeon"]
removed is: drum
After replacing 2: ["parrot", "anemone", "blue", "trumpet", "surgeon"]
removed is: ["angel", "clown"]
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Functions
Javascript 1.1 | Can format if...else statements to setup the ordered conditions. |
Javascript 1.0 | Can format if...else statements to setup the ordered conditions. |
JScript 3.0 | Can format if...else statements to setup the ordered conditions. |
JScript 2.0 | Can format if...else statements to setup the ordered conditions. |
JScript 1.0 | Can format if...else statements to setup the ordered conditions. |
Areas Affected:
Javascript 1.2 new Functions
Example:
The following code displays the myFish array before and after adding
elements to it.
myFish = ["angel", "clown"];
document.writeln("myFish before: " + myFish);
unshifted = myFish.unshift("drum", "lion");
document.writeln("myFish after: " + myFish);
document.writeln("New length: " + unshifted);
This example displays the following:
myFish before: ["angel", "clown"]
myFish after: ["drum", "lion", "angel", "clown"]
Javascript 1.1 | //returns a new array of arr.length+1 with 'data' appended.
function UnShiftJS11(arr, data) { var newarr = new Array () newarr[0] = data; for ( var i=0; i<arr.length; i++ ) { newarr[i+1] = arr[i]; } return newarr; } |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Functions
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Function - Array Object
Javascript 1.1 |
function myStringSubstr( str1, begin, length ) { // check number of arguments passed into the function if( myStringSubstr.arguments.length == 2 ) { end = str1.length; } else if( myStringSubstr.arguments.length == 3 ) { end = begin + length; } else { return null; } str2 = myStringSlice( str1, begin, end ); return str2; } |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Functions
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |
Areas Affected:
Javascript 1.2 Functions - Regular Expression
Javascript 1.1 | No Workaround exists |
Javascript 1.0 | No Workaround exists |
JScript 3.0 | No Workaround exists |
JScript 2.0 | No Workaround exists |
JScript 1.0 | No Workaround exists |