- Find out how to create a mouse-rollover image swapping effect
- Integrate Java applets into your Web pages
- Deploy cross-browser Dynamic HTML applications
- Learn how to use Netscape's debugger and how to build your own debugging tools
- Tables and calendars
- A lookup table
- An order form
- A table of contents
- Calculations and graphics
- Intelligent "updated" flags
- A decision helper
Read an Excerpt
Chapter 4: Browser and Document Objects
Scripts Run the Show
If you have authored in plain HTML, you are familiar with how HTML tags influence the way content is rendered on a page when viewed in the browser. As the page loads, the browser recognizes tags (by virtue of their containing angle brackets) as formatting instructions. Instructions are read from the top of the document downward, and elements defined in the HTML document appear on screen in the same order in which they are entered in the document. As an author, you do a little work one time up front - adding the tags - and the browser does a lot more work every time a visitor loads the page into a browser.
Assume for a moment that one of the elements on the page is a text field inside a form. The user is supposed to enter some text in the text field and then click the Submit button to send that information back to the Web server. If that information must be an Internet e-mail address, how do you ensure the user included the "@" symbol in the address?
One way is to have a Common Gateway Interface (CGI) program on the server scan the submitted form data after the user has clicked the Submit button and the form information has been transferred to the server. If the user omitted or forgot the "@" symbol, the CGI program resends the page, but this time with an instruction to include the symbol in the address. Nothing is wrong with this exchange, but it means a significant delay for the user to find out that the address does not contain the crucial symbol. Moreover, the Web server has has been transferred to the server. If the user omitted or forgot the "@" symbol, the CGI program resends the page, but this time with an instruction to include the symbol in the address. Nothing is wrong with this exchange, but it means a significant delay for the user to find out that the address does not contain the crucial symbol. Moreover, the Web server has had to expend some of its resources to perform the validation and communicate back to the visitor. If the Web site is a busy vile, the server may stop, trying to perform hundreds of these validations at any given moment, probably slowing response time to the user even more.
Now imagine if the document containing that text field had some intelligence built into it that could make sure the text field entry contains the IV symbol before ever sending one bit (literally) of data to the server. That kind of intelligence would have to be embedded in the document in some fashion downloaded with the page's content so it can stand ready to jump into action when called upon. The browser must know how to run that embedded program Some user action must start the program, perhaps when the user clicks the Start button. As the program runs, if it detects a lack of the "( )" symbol, an alert message should appear to bring the problem to the, user's attention.
Interactive user interfaces
Click on a gray widget icon to expand the items underneath. An endpoint item has an orange and black widget icon. Items in the outline can be links to other pages or descriptive information. You also maintain the same kind of font control over each entry as you would expect from HTML. While such outlines have been created with server CGIs in the past, the response time between clicks is terribly slow. By placing all of the smarts behind the outline inside the page, it downloads once and runs quickly after each click.
As demonstrated in the detailed description of this outline in the application Outline- Style Table of Contents (Chapter 50 of the bonus applications chapters on the CD- ROM), the scriptable workings can be implemented within straight HTML for Navigator 2 and 3 and in Dynamic HTML for Navigator 4 and Internet Explorer 4. Either way you do it, the quick response and action on the screen makes for a more engaging experience for Web surfers who are in a hurry to scout your site.
Small data lookup
Meet the Author
Most Helpful Customer Reviews
See all customer reviews
I found this book rather difficult to read, use or follow. I have some programming experience in other languages and I have read many programming books. However, this book is the worst one I have read so far. It is very poorly organized, and examples are not well explained. I can figure out most of the examples easily since I have some programming experience, but there are a handful that are still puzzling to me. The text seems to be aimed at a beginner, but it definitely is not. For example, it does not begin talking about control structures (if...else, etc.) until it reaches chapter 31, and chapter 32 introduces you to operator. However, this does not keep the author from using them in the first 30 chapters. Overall, I am very disappointed with this book and would not recommend it to anyone.
THIS BOOK ROCKS!!! READ IT PAGE BY PAGE OR ONLY LOOK UP WHAT YOU NEED. EXCELLENT EXAMPLES!!! DANNY GOODMAN IS A FORCE TO BE RECKONED WITH!!!
This book was written just after Netscape 4 and IE 4 came out. It is rather dated now. Also, the book refers to directories on the CD that don't exist, and the CD itself has broken links in HTML examples so you 'can't get there from here'.
This Java Script Book is OK. I have never writted Java Script before, therefore, I needed to see more real world scenerios, followed by example outputs. The scripting examples are OK, but what does it look like after compilation?