By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,527 Members | 1,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,527 IT Pros & Developers. It's quick & easy.

associating a onchange() event with a form tag.

P: 1
I have to call a function whenver data in any of the field element inside a form changes. I understand that I can associate the onchange() event with each and every field and get the work done.
My question is "whether there is a way to associate a single onchage() kind of event generator with the entire form". This shld allow the desired function to be called whenever an input field (text, select ...) data is modified.

Is it possible? Please let me know.

Thank you for the help.
Jul 18 '06 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,208
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function change(a) {
  3.     alert("something changed");
  4. }
  5. function checkchanges() {
  6. var y = document.all;
  7. for (i=0;i<y.length;i++) {
  8.     y[i].onchange = change;
  9.  }
  10. }
  11. </script>
  13. <body onload="checkchanges();">
Jul 18 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.