the above code works well in firefox but not in IE6 or IE7 and i didn't check it in IE8...Code:<script> onerror = function(a,b,c) { alert(a+c) } </script> <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) ) alert("yes") else alert("no") } Object.prototype.isEmail = _isEmail </script> <input type="text" name="email" id="email" value="sdf@sdf.com" /> <script> document.getElementById('email').isEmail() </script>
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... ???



Reply With Quote


Bookmarks