Java Script

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Apr 2007
Posts: 10
Reputation: SAMSEIED is an unknown quantity at this point 
Solved Threads: 0
SAMSEIED SAMSEIED is offline Offline
Newbie Poster

Java Script

 
0
  #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
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Java Script

 
0
  #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 Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Java Script

 
0
  #3
Apr 13th, 2007
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..
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 16
Reputation: connor4312 is an unknown quantity at this point 
Solved Threads: 0
connor4312's Avatar
connor4312 connor4312 is offline Offline
Newbie Poster

Re: Java Script

 
0
  #4
Apr 15th, 2007
I agree
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1419 | Replies: 3
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC