Solved

html page can't find JavaScript functions

Posted on 2008-10-09
3
971 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

867 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now