15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

length<br />

Chapter 7 ✦ The Form and Related Objects (Chapter 23)<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓<br />

Example<br />

Use The Evaluator (Chapter 13 in the <strong>JavaScript</strong> <strong>Bible</strong>) to determine the number<br />

of form controls in the first form of the page. Enter the following statement into the<br />

top text box:<br />

document.forms[0].length<br />

method<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓<br />

Example<br />

If you need to modify the first form in a document so that the content is sent via<br />

the POST method, the statement is:<br />

document.forms[0].method = “POST”<br />

target<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓<br />

Example<br />

If you want to direct the response from the first form’s CGI to a new window<br />

(rather than the target specified in the form’s tag), use this statement:<br />

document.forms[0].target = “_blank”<br />

339<br />

FORM.target

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

Saved successfully!

Ooh no, something went wrong!