Solved

html page can't find JavaScript functions

Posted on 2008-10-09
3
975 Views
Last Modified: 2013-11-19
Hi,

I'm puzzled by a problem I just started experiencing with my JavaScript (JS).  I define a number of JS functions in the head that are used for things like a calendar and operations for buttons and onclick.

I'm developing in Firefox and using the JS debugger addon which, when I click on a few of my buttons, tells me that function is not defined  e.g. "showAlert is not defined"

Except showAlert IS defined and I don't know why the page can't see it.  This is happening with most of the functions on the page, but there's one that still works, probably because it is the submit button for the page form with an onclick JS beforehand.

I've place a several alerts throughout the page body and they all fire.

How do I track down these missing function errors and find out what's happening?  

Thanks!
0
Comment
Question by:ugeb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 22681859
What you described typically happens when:
a. you give some element an id and/or name the same name that you gave the function.
b. you are assigning an anonymous function to a variabe, but the variable may be out of scope. ex:
instead of:
var myTableSorter=function(){...};

declare it as:
function myTableSorter(){...}

c. The browser may not be able to import you js files typically due to an incorrect path or a permission issue.
0
 
LVL 11

Author Closing Comment

by:ugeb
ID: 31504804
It actually had to do with a missing double quote that couldn't be seen or identified as an error in the editor for some reason.  But your comments helped me track it down, so thanks!
0
 
LVL 82

Expert Comment

by:hielo
ID: 22682120
you are welcome
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question