Sams Teach Yourself HTML 4 in 24 Hours
- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- Tell Us What You Think!
- Put Your HTML Page Online Today
- I. Your First Web Page
- Hour 1. Understanding HTML and XML
- Hour 2. Create a Web Page Right Now
- Hour 3. Linking to Other Web Pages
- Hour 4. Publishing Your HTML Pages
- II. Web Page Text
- Hour 5. Text Alignment and Lists
- Hour 6. Text Formatting and Font Control
- Hour 7. Email Links and Links Within a Page
- Hour 8. Creating HTML Forms
- III. Web Page Graphics
- Hour 9. Creating Your Own Web Page Graphics
- Hour 10. Putting Graphics on a Web Page
- Hour 11. Custom Backgrounds and Colors
- Hour 12. Creating Animated Graphics
- IV. Web Page Design
- Hour 13. Page Design and Layout
- Hour 14. Graphical Links and Imagemaps
- Hour 15. Advanced Layout with Tables
- Hour 16. Using Style Sheets
- V. Dynamic Web Pages
- Hour 17. Embedding Multimedia in Web Pages
- Hour 18. Interactive Pages with Applets and ActiveX
- Hour 19. Web Page Scripting for Non-Programmers
- Hour 20. Setting Pages in Motion with Dynamic HTML
- VI. Building a Web Site
- Hour 21. Multipage Layout with Frames
- Hour 22. Organizing and Managing a Web Site
- Hour 23. Helping People Find Your Web Pages
- Hour 24. Planning for the Future of HTML
- VII. Appendixes
- A. Readers' Most Frequently Asked Questions
- B. HTML Learning Resources on the Internet
- C. Complete HTML 4 Quick Reference
- D. HTML Character Entities
Strong Java
JavaScript and its competitors do have drawbacks and limitations. Scripting would be too slow for any high-volume data or image-processing work, and complex applications of any kind are poorly suited for direct inclusion in the text of an HTML document. After all, there are only so many lines of code you want to wade through to see the HTML itself.
When you outgrow JavaScript, does that mean you'll need to return to server-side scripting or applications programming? No. JavaScript is just the baby sister of a more robust and powerful language called Java. Like JavaScript, Java is especially designed for the Web. Also like JavaScript scripts, Java programs install and run automatically whenever a Web page is loaded. However, unlike JavaScript, Java programs are compiled into a more compact and efficient form (called bytecodes) and stored in a file separate from the Web pages that may call them.
Java also includes a complete graphics drawing library, security features, strong type checking, and other professional-level programming amenities that serious developers need. The biggest limiting factor with Java mini-applications (called applets) is that they must be small enough that downloading them doesn't delay the display of a Web page an intolerable amount of time. Fortunately, Java applets are extremely compact in their compiled form and are often considerably smaller than the images on a typical Web page.
A Java program will work equally well on both Windows and Macintosh computers. Best of all, Java's syntax is nearly identical to JavaScript's, so you can cut your teeth on JavaScript and easily move to Java when you need or want to.
You'll find many ready-to-use Java applets on the Web, and Figure 18.1 shows how to include them in a Web page. The two <applet> tags in Figure 18.1 insert two separate Java applets named Bounce.class and RnbText.class. (These class files must be placed in the same directory as the Web page.) The Bounce applet makes a graphical icon hop up and down, and the RnbText applet below it makes some text wiggle like a wave while rainbow colors flow through it. Figure 18.2 is a snapshot of these animated effects.
Figure 18.1 Java applets are prewritten programs that you place on your Web page with the <applet> tag.
Figure 18.2 The <applet> tags in Figure 18.1 insert programs for drawing a bouncing happy face and some wiggly, colorfully animated text.
The width and height attributes in the <applet> tag do just what you'd expect them to—specify the dimensions of the region on the Web page that will contain the applet's output. The <param /> tag supplies any information that a specific applet needs in order to do its thing. name identifies what information you're supplying to the applet, and value is the information itself. In this example, the RnbText applet is designed to display some text, so you have to tell it what text to display. The Bounce applet doesn't require any <param /> tag because it was designed to do just one thing, with no optional settings.
Every applet requires different settings for the name and value attributes, and most applets require more than one <param /> tag to set all their options. Whoever created the applet will tell you (usually in some kind of readme.txt or other documentation file) what name attributes you need to include and what sort of information to put in the value attributes for each name.
ActiveX Controls | Next Section

Account Sign In
View your cart