Hi:

I am designing this Dinner menu using Javascript, but when I up-load it, it only opens, the first pharase in green color that says dinner menu and it does not run which is suppose to show the menu for everyday's food.here is the codes, your help is apprecaited.
<HTML><HEAD><TITLE>SAM'S DINNER MENU</TITLE><SCRIPT LANGUAGE="JavaScript"><!---Hide from non-JavaScript browsers//This function Displays the Daily Dinner Specials at Kelsey's Dinerfuction DishName (Day) {var DName = new Array();DName[0]="Chicken Burio Amigo";DName[1]="Chicken Tajine";DName[2]="pizza Bella";DName[3]="Salmon Filla";DName[4]="Greek-style Shrimp";DName[5]="All you can eat fish";DName[6]="Prime Rib";return DName[Day];}fuction DishDesc (Day) {var DDesc=new Array();DDesc[0]="Chicken with mushrooms, onions and Monterey Jack in flour tortilla 9.95";DDesc[1]="Chicken baked with garlic.8.95";DDesc[2]="Large Pizza.8.95";DDesc[3]="Grilled salmon with spicy sauce.9.95";DDesc[4]="Shrimp,feta chees.9.95";DDesc[5]="Deep-fried code with baked potato.11.95";DDesc[6]="12-oz cut.12.95";return DDes[Day];}//Stop hiding---></SCRIPT></HEAD><BODY BACKGROUND="Tan.jPG"><CENTER><IMG SRC="Dinner.gif"></CENTER><H5 ALIGN=CENTER><FONT SIZE=+3 COLOR=GREEN>Dinner Menu</FONT><BR>Served 4:00p.m.-10:00p.m.<HR></H5><DL><H3>FONT COLOR=BLUE>TODAY'S SPECIAL</FONT></H3><SCRIPT LANGUAGE="JavaScript">

thanks
Sam

You should try using the built in debugger in Firefox or, even better, use the firebug extension. If there are JavaScript errors that will tell you what they are.

There are quite a few errors... Firstly, the keyword is 'function' and not 'fuction'. Secondly, in this line:

<!---Hide from non-JavaScript browsers
//This function Displays the Daily Dinner Specials at Kelsey's Diner

The phrase "Hide from non-Javascript browsers" will be parsed as script; you can stop that with commenting, a'la:

<!---//Hide from non-JavaScript browsers
//This function Displays the Daily Dinner Specials at Kelsey's Diner

Thirdly, maybe it's just been missed in your post, but there's no calls to either function DishName or DishDesc; so, it does't matter what happens in those functions, they will never be used.

Fourthly, perhaps this is a problem with the way you've pasted the code, but there should be line breaks in there. The most important ones are the ones that follow lines of comment; without a linebreak, everything from here: "//This function Displays " to the end of the script element is a javascript comment. Otherwise, linebreaks are good practice; they make it easier for you to read your code, and certainly make it easier for other people to read your code..

Using a debugger is good advice, but most debuggers will fail at the first error, and won't give helpful feedback ( like the line number where an error occured ) if your code is on one line..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.