View Full Version : Object cannot be extended in IE - Object does not support this property or method

03-12-2009, 09:13 AM
onerror = function(a,b,c) { alert(a+c) }

<script type="text/javascript">
function _isEmail()
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if( reg.test(this.value) )

Object.prototype.isEmail = _isEmail


<input type="text" name="email" id="email" value="sdf@sdf.com" />


the above code works well in firefox but not in IE6 or IE7 and i didn't check it in IE8...

i am trying to extend the Object type to add this isEmail method

so that i can call this function on any object like input elements...
since all the elements are basically of the type Object it should work and it works in FF... is there any frame work to do this... what about prototype.org... ???:confused:

03-12-2009, 03:41 PM
It is normally frowned upon to extend Object since it effects a lot of things.

Why don't you just extend String? It would just require you to type ....value._isEmail()


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum