• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event

 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,i'm a beginner in javascript, so can you please guide me,

I'm doing registration form , based on different event i want to do different things , like if the event is onsubmit() or onblur() i want to do different thing, in my javascript, how to know from which(Eventnsubmit,onblur....) this method was invoked ?

thank you
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just establish different methods for the different events.
 
Faisal Fuad
Ranch Hand
Posts: 83
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun, please have the basic ideas from these sites. Hope that will help you a little:

http://www.w3schools.com/js/js_events.asp
or
http://www.w3schools.com/jsref/event_onblur.asp
or
http://homepage.ntlworld.com/kayseycarvey/jss3p3.html

Best wishes
 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Just establish different methods for the different events.

it's a drag, if i can come to know what Event happened based on that i can to manipulation single method is enough
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a poor practice to have one method do completely disparate things based upon some input or other factor. Rather, create a method for each different action. It's not a drag, it's good engineering.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic