| Chapter 12: Scripting Web Pages |
|
|
|
| Sections - Part IV: Integrating Scripts with (X)HTML | |
|
When used in conjunction with your HTML markup, scripts -- small programs that you add to your Web page -- help your Web pages respond to user actions. Scripts create the interactive and dynamic effects you see on the Web, such as images that automatically change when visitors move mouse pointers over them, additional browser windows that pop up when a page loads, and animated navigation bars. Because scripts are mini-programs, they're often written in a programming language called JavaScript. If you are unfamiliar with the term, JavaScript may sound like a Hollywood screenplay doused with coffee. However, it is actually a scripting language built right into all popular Web browsers. Fortunately, because of the Nobel-Prize-worthy invention of "copy and paste," you don't need to be a technoguru to add scripting to your Web sites. The Web has many sites that feature canned JavaScript scripts that you can freely copy and then paste right into your Web page (Chapter 13 lists several of the best JavaScript sites). In this chapter, you explore how scripting works inside your Web page by dissecting three sample scripts written in JavaScript. Chapter 13 continues this discussion by diving deeper into the JavaScript language itself. Many good Web-page editors (such as Adobe Dreamweaver and GoLive) have built-in tools to help you create scripts -- even if you don't know anything about programming. Page 216: Visit Backup Brain and look for the buttons below the "Change your font" entry at the upper right corner of the page (buttons labeled "Sm sans" and "Lg serif").Page 216-217, Figure 12-2, Listing 12-1: Style switching (display view) (code view) Page 218, Figure 12-3, Listing 12-2: Pop-up windows (display view) (code view) Page 219-220: Listing 12-3, Figure 12-4: Validating form data (display view) (code view) Page 222: You can get to Gmail by entering www.gmail.com or mail.google.com. Take your pick!
.ZIP file of all code samples from this chapter (5kb)
|
|
| Last Updated on Monday, 30 June 2008 11:40 |