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.

{<br />

}<br />

var theirname=document.myForm.userName.value;<br />

if (theirname !="")<br />

alert("Hello "+theirname+"!");<br />

else<br />

alert("Don't be shy.");<br />

//-->><br />

<br />

<br />

<br />

<br />

What's your name?<br />

<br />

<br />

<br />

<br />

<br />

<br />

Not only can we read the contents of page elements, particularly form fields, but we can update<br />

their contents using <strong>JavaScript</strong>. Using form fields that are the most obvious candidates for this,<br />

we modify the previous example to write our response to the user in another form field.<br />

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

Saved successfully!

Ooh no, something went wrong!