...

View Full Version : FireFox/Moz JavaScript Console



]|V|[agnus
07-09-2004, 10:58 PM
What does "myFunction() is not a function." mean?

"myFunction() is undefined." happens when the function isn't there, but the function is definitely there in this instance. I've never seen this error before, and I'm not sure what to do about it.

sad69
07-09-2004, 11:03 PM
How are you calling this function? onLoad or something? Or is this function in a external JS file?

We need more information in order to debug your problem.

Sadiq.

]|V|[agnus
07-09-2004, 11:08 PM
Function is called from an <input> element like so


<input type="button" name="toggleDateRange" id="toggleDateRange" class="button" value="Toggle Date Range" onclick="toggleDateRange()" />

Function is in linked .js file linked like so


<script type="text/javascript" src="_admin.js"></script>

Function:



function toggleDateRange() {
var eventDate2 = document.getElementById("eventDate2");
if ((eventDate2.style.display == "")||(eventDate2.style.display == "none")) {
eventDate2.style.display = "block";
} else {
eventDate2.style.display = "none";
}
}

sad69
07-10-2004, 01:18 AM
Where do you link to the JS file? In the <head> or in the <body> ? It should be in the head..

Also, are you able to call other functions in that JS file?

Sadiq.

sad69
07-10-2004, 01:34 AM
One other thing that just came to mind:
If you recently added that function to the JS file, your browser may be caching the 'old version' of the JS file that does not have the specified function.

You can try holding down ctrl while refreshing the page and that might do it.

Sadiq.

]|V|[agnus
07-10-2004, 07:02 AM
In the head, and yes other functions work.

Willy Duitt
07-10-2004, 07:55 AM
<input type="button" name="toggleDateRange" id="toggleDateRange"
class="button" value="Toggle Date Range" onclick="toggleDateRange()" />

Both your button and function share the same name/id try changing the function name......

.....Willy



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum