Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

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

Chapter 5. JavaScript Windows and Frames > Project I: Creating, Populating, and...

Project I: Creating, Populating, and Closing Windows

There's a page on the Stitch Web site that lists the companies that have placed ads in the current issue of the magazine. Stitch is the fashion magazine and it attracts some huge companies as advertisers—the ads themselves are often as groundbreaking as the fashion. Because the magazine is bombarded with requests from readers who want to get in touch with the companies, the powers that be think putting the ads on the Web site is a great idea. Therefore, they have decided to expand the functionality of the page and make each company's name a link that will take the user to a page with the company's contact infor-mation, a link to their Web site, and a link to a copy of their current ad.

Guess who they have come to with the job of making this a reality? That's right—you. No reason to fear, though. With your recent additions to the site you are beginning to be known as the office JavaScript guru. After a quick planning meeting with your boss, you think you have devised a great way to accomplish the task. The one problem that kept coming up was the fact that there will be at least 20 advertisers in each month's issue—this many pages added to the site will crowd the server and make for quite a few files to update each month. So, here's the plan: We're going to use JavaScript arrays on the existing list page to store all of the information we will need to dynamically create a page for each company, which we will then put into a new window. This will save space on the server, allow us to update one file a month, and give us one heck of a project for this chapter. There are three parts to creating this script: First, we will define and create the arrays for each company's information. Next, we will write the function that will open up our new window and populate it with the content. Finally, we will need to insert the proper event handlers into the HTML to make it all happen.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint