•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,904 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,123 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 997 | Replies: 3
![]() |
•
•
Join Date: Apr 2007
Posts: 10
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
•
•
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation:
Rep Power: 5
Solved Threads: 34
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.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 943
Reputation:
Rep Power: 5
Solved Threads: 47
There are quite a few errors... Firstly, the keyword is 'function' and not 'fuction'. Secondly, in this line:
The phrase "Hide from non-Javascript browsers" will be parsed as script; you can stop that with commenting, a'la:
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..
<!---Hide from non-JavaScript browsers //This function Displays the Daily Dinner Specials at Kelsey's Diner
<!---//Hide from non-JavaScript browsers //This function Displays the Daily Dinner Specials at Kelsey's Diner
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..
If it only works in Internet Explorer; it doesn't work.
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- how can i pass a value from java script to JSP scriplet (JSP)
- Email validation using java script (JavaScript / DHTML / AJAX)
- Java Script new line (JavaScript / DHTML / AJAX)
- Java script - wordwrap ? (HTML and CSS)
- FireFox config setting through Java Script (Community Introductions)
- How to Embed CheckList Box on HTML Page using Java Script (HTML and CSS)
- A question on java script?(Please answer ASAP) (Java)
- java script for main menu (ASP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: HIDDEN Values <==Java Script Function Return value
- Next Thread: please help me in javascript



Linear Mode