Christophe Porteneuve wrote: > Hey there, > > rconnor a écrit : > > It's in the onload event of my page > > > > Simply says loadmessagebody(document.forms[0].docid.value) > > This won't work outside of IE, btw, since this is not DOM-based (your > "docid" property, which is name- or id-derived).
Incorrect. The forms collection is a formal collection in the W3C DOM HTML specification: <URL: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-1689064 > Dot property access to members of the form's elements collection is supported in browsers at least since Navigator 3 and IE 4, probably earlier. While not explicitly mentioned in the W3C specification, it is a feature of the ECMAScript Language and therefore can be expected to work on all compliant browsers. You could have tested your premise with a few lines of code: <form action=""> <div><input type="text" name="docid" value="the doc id"></div> </form> <script type="text/javascript"> alert(document.forms[0].docid.value); </script> > You might want to change your loadmessagebody to no arguments, then get > the value from its code like this: > > var value = $F('docid'); > > (Assuming your form field has an id attribute with value 'docid'. The > name field won't cut it). How does hard-coding the value of the form control help the OP's cause? When using forms, both $() and hence $F() have problems if id and name attributes share the same value. Using names for form controls is valid HTML and provides support for old browsers. -- Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
