Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FireFox/Moz JavaScript Console

    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.

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Function is called from an <input> element like so

    Code:
    <input type="button" name="toggleDateRange" id="toggleDateRange" class="button" value="Toggle Date Range" onclick="toggleDateRange()" />
    Function is in linked .js file linked like so

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

    Code:
    function toggleDateRange() {
    	var eventDate2 = document.getElementById("eventDate2");
    	if ((eventDate2.style.display == "")||(eventDate2.style.display == "none")) {
    		eventDate2.style.display = "block";
    	} else {
    		eventDate2.style.display = "none";
    	}
    }
    Last edited by ]|V|[agnus; 07-09-2004 at 10:17 PM. Reason: Absent mindedness...

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In the head, and yes other functions work.

  • #7
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •