[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

html page can't find JavaScript functions

Posted on 2008-10-09
3
Medium Priority
?
979 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

656 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