As to the other question...it could be a scope issue. I'd have to see it in an example to be of much help, but from the code you've posted, "this" would refer to the document window. Assuming the function is not wrapped in some other object, ie, its just freestanding in the document...
function ZipLookup(event) {
var e = Event.element(event);
if ( e.value.length != 5 ){
return;
}
if ( isNaN(e.value) ) {
alert( "Zipcode should be a number" );
return;
}
var this_id = e.id;
...
}
The Event.element(event) is a prototype function to get the source element that caused the event. The other option is to do observe the input using .bindAsEventListener('name_of_zipcode_input'); which would put the "this" keyword into the proper scope.
-Jerod
On 3/7/06, Bill Moseley <[EMAIL PROTECTED]> wrote:
On Tue, Mar 07, 2006 at 08:34:53PM -0500, Jerod Venema wrote:
> Try:
>
> <a name="form226phone_different_from_input_id"></a>
>
> and I bet it works.
Good call! Is that a problem with IE or my incorrect usage?
I have some other code that doesn't work in IE. I suspect a rather
basic _javascript_ question.
I have an element observed that calls ZipLookup on keyup:
function ZipLookup() {
if ( this.value.length != 5 ){
return;
}
if ( isNaN(this.value) ) {
alert( "Zipcode should be a number" );
return;
}
var this_id = this.id ;
[...]
Does prototype have any tools to make that work in all browsers?
this.value and this.id is undefined in IE.
Thanks,
--
Bill Moseley
[EMAIL PROTECTED]
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs