• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 26. Using Scripts in Your Web Page > Complete JavaScript Example

Complete JavaScript Example

Without knowing much about the actual syntax of the JavaScript language, it is difficult to construct an example at this point that clearly outlines its usefulness. Do not be dismayed; JavaScript is covered in more detail in Chapter 27. Consider a quick calendar page to get a better sample of properties, methods, and events in action. This example Web page features a calendar ActiveX control that is availabel from Microsoft. With such an object on a Web page, you don't need to worry about users entering illegal dates such as February 31 on an entry form. It also makes your life easier as a Web page developer because you don't need to write convoluted logic to test that the user's input was accurate; you can trust that the ActiveX control will do that work for you. Figure 26.3 shows the final Web page with the calendar ActiveX control, as well as a standard HTML text area that shows a textual equivalent of the date whenever a new date is picked in the control. There are two additional HTML buttons that allow the user to move backward and forward through the calendar by month; they're at the bottom of the screen. Listing 26.3 contains the source code necessary to implement the JavaScript on this sample page. This event is handled by JavaScript on the Web page that updates the HTML for a textual equivalent of the date.

Figure 26.3. JavaScript can act as the glue on a Web page to bind ActiveX controls to other HTML objects on the page.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint