• 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 with JavaScript

On the Stitch Web site is a page that lists the companies that have placed ads in the current month's issue of the magazine. Stitch is the fashion magazine that attracts some huge companies as advertisers, and the ads themselves are often as groundbreaking as the fashion. Because the magazine is bombarded with requests of how to get in touch with the companies, the powers that be think having the ads on the Web site is a great idea. Therefore, the decision has been made to expand the functionality of the page and make the list of companies' links that will take the user to a page with the companies' contact information, 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 JavaScript guru in the office. So, after a quick planning meeting with your boss, you think you have come up with 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 is 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, it will allow us to update one file a month, and it will 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 the companies' information; next, we will write the function that will open up our new window and populate it with the content; and finally, we will insert the proper event handlers into the HTML to make it all happen.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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