...

View Full Version : I dont Know why i get this error



jcdevelopment
01-03-2008, 08:34 PM
When i validate my JS the only error i get is this





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

Arty Effem
01-04-2008, 03:06 AM
[quote]
it says mouseCoords is not defined....

Why would it be saying thatProbably 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.

jcdevelopment
01-04-2008, 03:41 PM
Im sorry, thank you for your help but i figured out what i did...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum