Click to See Complete Forum and Search --> : [RESOLVED] Using "this" to call javascript function


alirezaok
05-22-2007, 04:44 PM
hi

what is diffrence between onChange="this.submit()" and onChange="submit(this)" ?

thanks

bradgrafelman
05-22-2007, 06:23 PM
Assuming that is added to an element inside a FORM tag (e.g. an INPUT element), nothing. submit() is a native function for FORMs (e.g. you can't define your own submit() function).

alirezaok
05-23-2007, 02:20 AM
if submit changing to another word. example:

onChange="this.run()"
onChange="run(this)"

what is diffrence?

bradgrafelman
05-23-2007, 03:27 AM
this.run() implies that the object has some sort of run() method native to it.

run(this), however, means that your own run() function is executed with a reference to the object passed as a parameter.

cgraz
05-23-2007, 05:23 AM
Don't forget to mark this thread resolved :D

alirezaok
05-23-2007, 01:01 PM
thanks and sure