Connecting Tech Pros Worldwide Forums | Help | Site Map

associating a onchange() event with a form tag.

Newbie
 
Join Date: Jul 2006
Posts: 1
#1: Jul 18 '06
Hello,
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.
-ceeeyem.

iam_clint's Avatar
Forum Leader
 
Join Date: Jul 2006
Location: Oklahoma
Posts: 1,076
#2: Jul 18 '06

re: associating a onchange() event with a form tag.


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>
  12.  
  13. <body onload="checkchanges();">
  14.  
Reply