Adding extra attributes to webform input element
see this Form API Quickstart Guide http://drupal.org/node/751826 to review how to build forms, know how a form is builded:


  The Drupal Form API provides sophisticated form techniques and also
  allows for almost unlimited possibilities for custom theming,
  validation, and execution of forms. Even better, ANY form (even those
  in core) can be altered in almost any way imaginable--elements can be
  removed, added, and rearranged.


if your javascript is for validate fields of your form, I guess that this answer (related with validations of fields) could be useful How do I create custom content types in drupal?