I'm looking for some assistance on a case study...I have two arrays <head>: one for daily special dish name, second for the daily dish description, then I have two document.write: a daily special dish name <dt>, second to write the daily dish description <dd>. DishName works, just can't figure out the description. The <body> code was provided, I only need to get (and understand) the two arrays and two document.write scripts working. I've just started JavaScript, so please be gentle :-)
[HTML]<html>
<head>
<title>Kelsey's Dinner Menu</title>
<script language="JavaScript">
<!-- Hide from non-JavaScript browsers[/HTML]
Expand|Select|Wrap|Line Numbers
- function DishName (Day) {
- var DName=new Array();
- DName[0]="Chicken Burrito Amigo";
- DName[1]="Chicken Tajine";
- DName[2]="Pizza Bella";
- DName[3]="Salmon Filet";
- DName[4]="Greek-style Shrimp";
- DName[5]="All-you-can-eat-fish";
- DName[6]="Prime Rib";
- return DName[Day];
- }
- function DishDesc (Day) {
- var DDesc=new Array();
- DName[0]="Chicken with mushrooms, onions, and Monterey Jack cheese wrapped in a flour tortilla. 9.95";
- DName[1]="Chicken baked with garlic, olives, capers, and prunes 8.95";
- DName[2]="Large pizza with pesto, goat cheese, onions, and mozzeralla cheese 8.95";
- DName[3]="Grilled Salmon with spicy curry sauce and baked patato. 9.95";
- DName[4]="Shrimp, feta cheese, and tomatoes simmered in basil and garlic. 9.95";
- DName[5]="Deep-fired cod with baked patato and rolls. 9.95";
- DName[6]="12 oz. cut with baked patato, rolls, and dinner salad. 12.95";
- return DDesc[Day];
- }
- // Stop hiding -->
<style>
body {}
h3 {color:blue;}
dt {font-weight:bold; color:green;}
</style>
</head>
<body>
<center><img src="dinner.jpg">
<h5><span style="font-size:x-large; color:green">
Dinner Menu</span><br>
Served 4:00 p.m. - 10:00 p.m.</h5><hr></center>
<dl>
<h3>Today's Special</h3>
<dt>
<script language="JavaScript">
<!-- Start hiding from non-JavaScript browser
//Insert the titles of the nightly specials below
var Today=new Date();
var WeekDay=Today.getDay();
var SpecialName=DishName(WeekDay);
document.write(SpecialName);
//Stop hiding -->
</script>
<dd>
<script language="JavaScript">
<!--- Start hiding from non-JavaScript browser
//Insert the descriptions of the nightly specials below
var Today=new Date();
var WeekDay=Today.getDay();
var SpecialDesc=DishDesc(WeekDay);
document.write(SpecialDesc);
//Stop hiding -->
</script>
<dt><hr>Cajun Meatloaf
<dd>Lean beef served with Kelsey's Southwestern mashed potatoes. 8.95
<dt>Chicken Marsala
<dd>Plump chicken breasts sauteed with tomatoes, mushrooms, & artichoke hearts
with a splash of Marsala wine. 8.95
<dt>Pecan Crusted Whitefish
<dd>Quickly seared fish & fresh mushrooms served with pineapple chutney. 10.95
<dt>Thai Stir Fry
<dd>Fresh crisp vegetables quickly sauteed, tossed with Kelsey's spicy
peanut sauce, served over rice. 8.95
<dt>Jambalaya
<dd>Plump shrimp, chicken, & spicy sausage slowly simmered with tomatoes and
rice. 9.95
<dt>Wild Rice Stuffed Squash
<dd>Winter squash stuffed with fresh harvest vegetables & pecan rice, served
with pineapple chutney & melted Monterey Jack. 8.95
<dt>Cuban Beans & Rice
<dd>Black turtle beans simmered with carrots, tomatoes, & green peppers,
served over rice with spicy salsa, guacamole, & flour tortillas. 7.95
</dl>
</body>
</html>[/HTML]
Cheers,
pmactdot