943,627 Members | Top Members by Rank

Ad:
Apr 13th, 2007
0

Java Script

Expand Post »
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
Similar Threads
Reputation Points: 9
Solved Threads: 0
Newbie Poster
SAMSEIED is offline Offline
12 posts
since Apr 2007
Apr 13th, 2007
0

Re: Java Script

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.
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Apr 13th, 2007
0

Re: Java Script

There are quite a few errors... Firstly, the keyword is 'function' and not 'fuction'. Secondly, in this line:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <!---Hide from non-JavaScript browsers
  2. //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:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <!---//Hide from non-JavaScript browsers
  2. //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..
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
MattEvans is offline Offline
1,091 posts
since Jul 2006
Apr 15th, 2007
0

Re: Java Script

I agree
Reputation Points: 9
Solved Threads: 0
Newbie Poster
connor4312 is offline Offline
16 posts
since Apr 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: problem with setTimeout()
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: please help me in javascript





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC