Section 4.4. Using the DOM without Ajax


4.4. Using the DOM without Ajax

Since the Document Object Model isn't tied to your asynchronous programming, there's nothing preventing you from using the DOM in all your web applications. In fact, we're going to prove it to you...

The Great Chapter 4 Coding Challenge

Write a killer web application that uses the Document Object Model to create a dynamic user interface, without writing any Ajax code.

If you can pull this off, then you'll know that you can use the DOM to make all your applications better, even if they aren't making asynchronous requests.

Alright, I'm psyched! I want to learn more about the DOM. So where can I find out how to use this thing?

Better visit your local tree farm...

Hi there, and welcome to the Webville Tree Farm. What can I cut down for you today?

Tree farm? I'm sorry... I must be in the wrong place. I was told I needed to learn about something called the "Document Object Model."

Mike, Webville Tree Farm owner and founder.

Mike: Oh, you're in exactly the right place. I can help you with the Document Object Model. In fact, we get a lot of requests for that around here.

Jenny: Huh? Maybe you don't understand... I'm talking about programming web pages. All you seem to have is a bunch of trees.

Mike: That's right. Trees are exactly what you want.

Jenny: Maybe I'm not being clear here. I want to program web pages, and change the way a page looks using JavaScript. What does that have to do with trees?

Mike: Every web page is, in fact, a tree.

Jenny: Is this some sort of weird simile? How are web pages like trees?

Mike: You aren't listening to me. I didn't say web pages are like trees... I said web pages are trees. Every time you give a browser a page full of HTML, the browser sees that HTML as a tree.

Jenny: How does that work? I guess I can see how HTML has some structure to it, but I've never heard anything about web browsers and trees before.

Mike: Yeah, most people haven't. But if you're going to change and update web pages with JavaScript, you've gotta get ahold of the tree concept. Here, let me show you what I mean...




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