User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Apr 2007
Posts: 10
Reputation: SAMSEIED is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
SAMSEIED SAMSEIED is offline Offline
Newbie Poster

Java Script

  #1  
Apr 13th, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 34
Moderator
Staff Writer
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Java Script

  #2  
Apr 13th, 2007
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!
Reply With Quote  
Join Date: Jul 2006
Location: Deptford, London
Posts: 943
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 5
Solved Threads: 47
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Posting Shark

Re: Java Script

  #3  
Apr 13th, 2007
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..
If it only works in Internet Explorer; it doesn't work.
Reply With Quote  
Join Date: Apr 2007
Location: FL
Posts: 16
Reputation: connor4312 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
connor4312's Avatar
connor4312 connor4312 is offline Offline
Newbie Poster

Re: Java Script

  #4  
Apr 15th, 2007
I agree
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 3:20 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC