Solved

html page can't find JavaScript functions

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

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.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

733 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