O'Reilly logo

JavaScript Application Cookbook by Jerry Bradenbaugh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

prefs.html

Although the sequence of screen captures leads you through the true progression of events (i.e., the user begins with no preference settings), let’s assume the user has previously set user preferences and is returning to prefs.html to make changes. I think you’ll find it much easier to follow. Example 7.1 shows prefs.html.

Example 7-1. prefs.html

 1 <HTML> 2 <HEAD> 3 <TITLE>Take-A-Dive User Preferences</TITLE> 4 <STYLE type="text/css"> 5 BODY, TD { font-family: Arial; } 6 </STYLE> 7 <SCRIPT LANGAUGE="JavaScript1.2" SRC="cookies.js"></SCRIPT> 8 <SCRIPT LANGUAGE="JavaScript1.2"> 9 10 var imagePath = 'images/'; 11 var newsNames = new Array( 12 new Array('The Wall Street Journal','http://www.wsj.com/'), 13 new Array('Barron\'s Online','http://www.barrons.com/'), 14 new Array('CNN Interactive','http://www.cnn.com/'), 15 new Array('MSNBC','http://www.msnbc.com/'), 16 new Array('Fox News','http://www.foxnews.com/') 17 ); 18 19 var indexNames = new Array( 20 new Array('The New York Stock Exchange','http://www.nyse.com/'), 21 new Array('NASDAQ','http://www.nasdaq.com/'), 22 new Array('Dow Jones Indexes','http://www.dowjones.com/') 23 ); 24 25 var strategy = new Array( 26 new Array('Cheap', 'I\'m Really Cheap'), 27 new Array('Stingy', 'I\'m Pretty Stingy'), 28 new Array('Conservative', 'I\'m Conservative'), 29 new Array('Moderate', 'I\'m a Moderate'), 30 new Array('Agressive', 'I\'m Aggressive'), 31 new Array('Willing to sell mother', 'I\'d Sell My Mother!') 32 ); 33 34 var ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required