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 3 of 3
  1. #1
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    Thanked 257 Times in 257 Posts

    I dont Know why i get this error

    When i validate my JS the only error i get is this


    Code:
    function mouseCoords(ev){
    
    	if(ev.pageX || ev.pageY){
    
    		return {x:ev.pageX, y:ev.pageY};
    
    	}
    
    	return {
    
    		x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
    
    		y:ev.clientY + document.body.scrollTop  - document.body.clientTop
    
    	};
    
    }
    it says mouseCoords is not defined....

    Why would it be saying that, im fairly new to JS so any help would be great, let me know if you need anything else

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    [QUOTE=jcdevelopment;643825]
    it says mouseCoords is not defined....

    Why would it be saying that
    Probably because the function is being referenced prior to being rendered. You will need to show more code, preferably the entire document or URL to determine why.

    Also, your function assumes that it will be passed the event object as a parameter, which not all browsers do.

  • #3
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    Thanked 257 Times in 257 Posts
    Im sorry, thank you for your help but i figured out what i did...


  •  

    Posting Permissions

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