The problem seems to be with how you are trying to run the code on
page load. If you are trying to use the dom:loaded method, you would
need to do this:

document.observe("dom:loaded", findForms);

Also, getElementsByClassName is deprecated now in Prototype. You can
use the CSS selector - $$('form.foo');

Hope that helps!

On Oct 24, 8:21 am, Clifford James <[EMAIL PROTECTED]> wrote:
> I got the following HTML:
>
> <form id="form1" action="" method="post" class="validate">
>         <table>
>                 <tr>
>                         <td><label for="name" 
> id="label_name">Naam</label></td>
>                         <td><input type="text" id="name" name="name" 
> class="required"/></
> td>
>                 </tr>
>                 <tr>
>                         <td><label for="email" 
> id="label_email">Email</label></td>
>                         <td><input type="text" id="email" name="email" 
> class="required"/></
> td>
>                 </tr>
>                 <tr>
>                         <td valign="top"><label for="message" 
> id="label_message">Bericht</
> label></td>
>                         <td><textarea id="message" name="message" rows="4" 
> cols="20"></
> textarea></td>
>                 </tr>
>                 <tr>
>                         <td colspan="2" align="right"><input 
> type="submit"/></td>
>                 </tr>
>         </table>
> </form>
>
> And the following JavaScript:
> function findForms()
> {
>         var forms = document.getElementsByClassName('validate');
>
>         // alert returns [object HTMLCollection]
>         alert(forms);
>
>         // this isn't working:
>         for(var i = 0; i < forms.length; i++) alert(forms[i].id);
>
>         // this isn't working:
>         forms.each(function(form) { alert(form.id) } )
>
> }
>
> document.onload = findForms();
>
> What is going wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to