Ah. I see. Thank you! This client-side scripting is new to me...
On Aug 3, 6:21 pm, Tom Gregory <[EMAIL PROTECTED]> wrote: > You're still not calling it "onload", you're calling it when it's > encountered. It's because you were assigning the function result, not > the function reference. > > Had you done > window.onload = uploadFrames; // <-- Assign function reference, no > parenthesis > you would have been fine. > > Instead, you were assigning the return value of calling the function > to window.onload. > window.onload = uploadFrames(); // <-- Incorrect for what you want; > Assigning return value > > TAG > > On Aug 3, 2007, at 4:46 PM, saiena wrote: > > > > > > > Got it, now. > > > I had to put the window.onload function in a script tag at the very > > end of the body rathe rthan in the head. > > > -saiena > > > On Aug 3, 9:31 am, saiena <[EMAIL PROTECTED]> wrote: > >> Thanks for your reply. The unassigned variable was just an error ai > >> made when posting to the group. Thanks for the tip on using the $A. I > >> can now get the funciton to work under some conditions, e.g., on a > >> mousedown event. The problem is that it won't work on a window load. > >> in the code below, clicking the "CLICK ME" link corretly return > >> '2' as > >> the count. But the onload event always reports '0'. > > >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > >> <html xmlns="http://www.w3.org/1999/xhtml"> > >> <head> > >> <meta http-equiv="Content-Type" content="text/html; > >> charset=iso-8859-1"> > >> <script src="/includes/prototype.js" type="text/javascript"></ > >> script> > >> <script language="JavaScript" type="text/JavaScript"> > >> function uploadframes(){ > >> var count = > >> $A(document.getElementsByClassName('nmd_upload_iframetype')).length; > >> document.write(count); > >> } > >> window.onload=uploadframes(); > >> </script> > > >> </head> > >> <body> > >> <a href="" onMouseDown="uploadframes()">CLICK ME</a> > > >> <table class="bealle" width="758" border="0" cellspacing="0" > >> cellpadding="0" align="center"> > >> <tr> > >> <td valign="top"> > >> <form class="nmd_upload_iframetype" nmdformtype="fileupload" > >> id="file_upload_8" method="post" enctype="multipart/form-data" > >> action="/nmd_modules.php?mod=upload&assetpath=%2Fassets%2Fphotos > >> %2F&filetype=img&forcewidth=300&forceheight="> > >> FORM CONTROLS HERE > >> </form> > >> </td> > >> </tr> > >> <tr> > >> <td valign="top"> > >> <form class="nmd_upload_iframetype" nmdformtype="fileupload" > >> id="file_upload_9" method="post" enctype="multipart/form-data" > >> action="/nmd_modules.php?mod=upload&assetpath=%2Fassets%2Fphotos > >> %2F&filetype=img&forcewidth=300&forceheight="> > >> FORM CONTROLS HERE > >> </form> > >> </td> > >> </tr> > >> </table> > >> </body> > >> </html> > > >> On Aug 3, 12:09 am, "Bastian Feder" <[EMAIL PROTECTED]> wrote: > > >>> Hey Saiena, > > >>> you are using different variables for teh array og elements and > >>> for the > >>> count. > > >>> Make it: > >>> var count = formarray.length; > > >>> this should do ;o) > > >>> But in your case .. why don't you us $A ?? > > >>> e.g: > >>> var count = $A(document.getElementsByClassName > >>> ('nmd_upload_iframetype')).length; > > >>> hf > >>> Bastian > > >>> On 8/3/07, saiena <[EMAIL PROTECTED]> wrote: > > >>>> I could really use some help with the proper syntax to access the > >>>> values returned by > >>>> getElementsByClassName (and similar functions): > > >>>> My HTML code includes several forms with a specific class: > >>>> <form class="nmd_upload_iframetype" id="file_upload_8" ...> > >>>> etc... > >>>> </form> > > >>>> I've included prototype.js, and am running the following code: > > >>>> var formarray = > >>>> document.getElementsByClassName('nmd_upload_iframetype'); > >>>> var count = form.length; > >>>> document.write(count); > >>>> This code prints '0' > > >>>> Any advice will be appreciated. > > >>> -- > >>> -- > >>> spread the word ... seewww.browsehappy.com;o) > > >>> Calvin: Weekends don't count unless you spend them doing something > >>> completely pointless. > > >>> Join the Greater IBM Connection (http://www.xing.com/ > >>> premiumgroup-6291.d26b7d)-Hide quoted text - > > >>> - Show quoted text -- Hide quoted text - > > >> - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
