11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

File upload fields have one extra property shown in Table 14-9 in addition to those provided by<br />

the HTMLInputElement. <strong>The</strong> accept attribute is used to define the MIME types the user may<br />

upload. Unfortunately, given the lack of browser support for this attribute, it is useless.<br />

Table 14-9: Additional Property of with Type "file"<br />

Property Description<br />

accept Comma-separated list of MIME types of files the user is permitted to<br />

upload<br />

Note A common oversight with file upload fields is that in order to work, the form must have<br />

method="POST ", and the enctype attribute must be set to ―multipart/form-data‖.<br />

Select Menus<br />

In (X)HTML, the tag is used to create two different kinds of pull-down menus. <strong>The</strong><br />

first and most common is a single-choice menu, often simply called a pull-down. <strong>The</strong> second<br />

form of the menu allows for multiple choices to be made and is generally referred to as a<br />

scrolled list. Under <strong>JavaScript</strong>, we traditionally refer to both tags through one object, simply<br />

termed the Select object. Under the DOM Level 1, this combination is preserved, but the object<br />

is correctly known as the HTMLSelectElement.<br />

To begin the discussion, we first present an example of both the common single-item pull-down<br />

and the multiple-choice item in XHTML:<br />

Single Robot Choice:<br />

<br />

<br />

Security<br />

Trainer<br />

Friend<br />

Cook<br />

<br />

Multiple Robot Choice:<br />

<br />

Security

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!