Answers
Nov 28, 2006 - 08:40 AM
HTMLElement.prototype.hasClassName = function( test){ return this.className == test}
With MSIE 6.0 document.getElementById( "myID").property shows "undefined"
MSoft does not follow standards. There is also a compile switch that affects prototype:
( See Note at http://msdn2.microsoft.com/en-US/libr...)
>> The prototype property of a built-in object cannot be modified when running in fast mode, the default for JScript. To compile a program from the command line that uses the prototype property, you must turn off the fast option by using /fast-. It is not safe to turn off the fast option in ASP.NET because of threading issues.
Nov 28, 2006 - 08:44 AM
With Firefox / Mozilla it works as expected
HTMLElement.prototype.hasClassName = function( test){ return this.className == test}
With MSIE 6.0 document.getElementById( "myID").prototype shows "undefined"
MSoft does not follow standards. There is also a compile switch that affects prototype:
( See Note at http://msdn2.microsoft.com/en-US/library/0cyeksx4....)
>> The prototype property of a built-in object cannot be modified when running in fast mode, the default for JScript. To compile a program from the command line that uses the prototype property, you must turn off the fast option by using /fast-. It is not safe to turn off the fast option in ASP.NET because of threading issues.
Nov 28, 2006 - 08:59 AM
at the paragraph "Prototypes with HTML objects"
Nov 28, 2006 - 09:27 AM
if (isGecko) { // add the method
HTMLElement.prototype.hasClassName = function( test){ return this.className == test}
}
else if (isMSIE) { // add the function
var hasClassName = function( elem, test){ return elem.className == test}
}
Jan 09, 2007 - 11:01 AM
What I understand now is that IE doesn't 'expose' the html-element object so that it is impossible to 'prototype' it.
I've tried some of the scripts that are supposed to define the 'missing' HTMLElement in IE and copy all the properties from the 'unidentified' object but for some reason I didn't get it to work.
Everything works wonderfully well in most other browsers though.
Jakob
Add New Comment