Re: Accessing Form attributes instead of elements

Hambo
Fri, 21 Sep 2007 07:46:11 -0000

getAttribute Method Internet Development
Index<mk:@MSITStore:D:\My%20Documents\电脑技术文档\HTML\DHTML%20手册.chm::/DHTMLref/default.html>
------------------------------

Retrieves the value of the specified attribute.

Syntax

*vAttrValue* = *object**.getAttribute(**sAttrName** [**, **iFlags**]**)*

Parameters

  *sAttrName* Required. *String* that specifies the name of the attribute. *
iFlags* Optional. *Integer* that specifies one or more of the following
flags:  0 Default. Performs a property search that is not case-sensitive,
and returns an interpolated value if the property is found. 1 Performs a
case-sensitive property search. To find a match, the uppercase and lowercase
letters in *sAttrName *must exactly match those in the attribute name. If
the *iFlags *parameter for *getAttribute* is set to 1 and this option is set
to 0 (default), the specified property name might not be found. 2 Returns
the value exactly as it was set in script or in the source document.

Return Value

*Variant* that returns a *String*, number, or *Boolean* value as defined by
the attribute. If the attribute is not present, this method returns null.

Remarks

If two or more attributes have the same name (differing only in uppercase
and lowercase letters) and *iFlags *is 0, the *getAttribute* method
retrieves values only for the last attribute created with this name, and
ignores all other attributes with the same name.

When retrieving the
CLASS<mk:@MSITStore:D:\My%20Documents\电脑技术文档\HTML\DHTML%20手册.chm::/DHTMLref/properties/classname.html>attribute
using this method, set the
*sAttrName *to be "className", which is the corresponding Dynamic HTML
(DHTML) property.

This method is used only by events created from HTML Components.

Standards Information

This method is defined in World Wide Web Consortium (W3C) Document Object
Model (DOM) Level 1
<http://www.w3.org/tr/2000/wd-dom-level-1-20000929/> [image:
Non-Microsoft link].



2007/9/21, Jean-Philippe Encausse
<Jp@encausse.net>:
>
>
> I didn't knew this method ?
> I find a solution: I did form.attributes['name'].value it works on
IE and
> FF
>
>
> On 9/21/07, Wizz <woutawizz@gmail.com> wrote:
> >
> > isn't that what the readAttribute method is for?
> >
> > form.readAttribute('name');
> >
> > On Sep 20, 12:04 pm, "Jean-Philippe Encausse"
<J...@encausse.net>
> > wrote:
> > > Hi,
> > >
> > > I'm sorry for this JavaScript Off topic question a little bit
tricky:
> > >
> > > I have an HML Form with:
> > > - An input using name="name"
> > > - An attibute name="formName"
> > >
> > > In JavaScript I would like to access the form's attribute.
How to do
> that ?
> > >
> > > - form.name returns input
> > > - form['name'] returns input
> > >
> > > Any idea ?
> > > Best regards and sorry for the off topic
> > >
> > > --
> > > Jean-Philippe Encausse - Veille / R&D Jalios SA
> > > Jp [at] encausse.net
-http://www.encausse.com-http://www.jalias.com
> > > GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net
> > > Mob: +33 6 82 12 56 99 - Job: +33 1 39 23 92 83 - Tel: +33 1 39
18 90
> 15
> > > Do it Once, Use it Twice ~ Do it Twice, Make It Once
> >
> >
> > >
> >
>
>
> --
> Jean-Philippe Encausse - Veille / R&D Jalios SA
> Jp [at] encausse.net - http://www.encausse.com - http://www.jalias.com
> GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net
> Mob: +33 6 82 12 56 99 - Job: +33 1 39 23 92 83 - Tel: +33 1 39 18 90 15
> Do it Once, Use it Twice ~ Do it Twice, Make It Once
>
> >
>


--
Hambo
szhambo@gmail.com

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe@googlegroups.com