Section 2.36. Frequently Asked Questions?


2.36. Frequently Asked Questions?

Q:

Why don't we have to use that JavaScript utility file from Chapter 1 to update the address field?

A:

In Chapter 1, we were updating the text in a <span> element. Since <span> isn't an HTML element that you usually type in, it doesn't have a value property; the same is true for most other HTML elements, like <p>, <em>, and <div> .

For form fields, though, you usually do need to enter a value. To make that easier, you can just use the value property on a form field element, and get and set its text value directly.

Q:

Couldn't we just use a <div> for the customer's address? Why are we using a field, anyway?

A:

Even though the Break Neck server looks up the customer's address, there are times when a customer might want their pizza delivered to some other address (like for that big Super Bowl party). So the customer's address is filled in for them, but they can still enter a different address if they want.

Don't worry, though-we're going to talk about <span>, <div>, and updating your HTML a lot more in Chapter 4.




Head Rush Ajax
Head Rush Ajax (Head First)
ISBN: 0596102259
EAN: 2147483647
Year: 2004
Pages: 241

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net