GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  HTML::DOM::COLLECTION::ELEMENTS (3)

.ds Aq ’

NAME

HTML::DOM::Collection::Elements - A subclass of HTML::DOM::Collection for form elements

CONTENTS

VERSION

Version 0.054

SYNOPSIS



  use HTML::DOM;
  $doc = HTML::DOM->new;
  $doc->write(
      <form>
          <input name=r type=radio value=1>
          <input name=r type=radio value=2>
      </form>
  );
  $doc->close;
 
  $elements = $doc->forms->[0]->elements;
  # returns an HTML::DOM::Collection::Elements object
   
  $elements->[0]; # first radio button
  $elements->item(0); # same

  $elements->{r}; # an array of buttons named r
  $elements->namedItem(r); # same
  () = $elements->namedItem(r); # list, not array
 
  $elements->length; # same as scalar @$elements



DESCRIPTION

This implements the HTMLCollection interface as described in the W3C’s DOM standard, except that the namedItem method (and the corresponding hash dereference) will return a list of form elements if there are several with the same name. This is actually in violation of the DOM standard, but it is in accordance with the way most web browsers work (at least Safari and Firefox).

CONSTRUCTOR

Normally you would simply call HTML::DOM::Element::Form’s elements method (as in the SYNOPSIS). But if you wall to call the constructor anyway, here is the syntax:



  $elements = HTML::DOM::Collection::Elements->new($nodelist)



$nodelist should be a node list (HTML::DOM::NodeList) object.

METHODS

$elements->length Returns the number of items in the collection.
$elements->item($index) Returns item number $index, numbered from 0. Note that you call also use $elements->[$index] for short.
$elements->namedItem($name) Returns the item named $name, is there is only one. If there is more than one, it returns a node list object in scalar context, or a list in list context. You can also write $collection->{$name}.

SEE ALSO

HTML::DOM

HTML::DOM::Collection

HTML::DOM::Element::Form

HTML::DOM::NodeList (manpage not written yet)

HTML::DOM::NodeList::Magic (manpage not written yet)

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 HTML::DOM::COLLECTION::ELEMENTS (3) 2014-12-23

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.