# Javascript in Website not running in Firefox



## dtpollock (Aug 14, 2005)

Hey all

I'm building a website for a Polytech project.

I've inserted a mousetrail (in pretty much every page) written in Javascript. The only problem is, it works great in IE, but not in Firefox......and my tutor will probably be using Firefox when he views it for marking.

If need be, I can write out the code in my next post, which will be in the morning.
If anyone can help with my problem, please get back to me.

Cheers


----------



## tomdkat (May 6, 2006)

Open the "Error Console" in Firefox when viewing a page with your JavaScript mouse trail to see if there are any errors being generated. JavaScript mouse trails CAN and DO work in Firefox (I just looked at one on another site) so there must be something up with your JavaScript code. Posting your code will help others assist you. 

Peace...


----------



## dtpollock (Aug 14, 2005)

Hey Tomdkat

Thanks for your prompt response to my post. The following is the Javascript that I've Cut and Pasted in all my pages. First, what's written in the

Now the

I ran the Error Console as you suggested. Having no experience with the Error Console whatsoever, when I ran it I got back approximately 120 or so errors, all highlighting the same thing. The only line that is highlighted in these errors is line 43 of my page which states:

x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX

However, me being me, and having no experience with Javascript, I have no idea how to fix it. If you, or anyone else out there can help, that'd be fantastic.

Cheers


----------



## tomdkat (May 6, 2006)

Ok, in the Error console, it states "event is not defined".

Here is the function around line #43:

```
function anddo(e){
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
doit=1
}
```
In line #43:

x = (document.layers) ? e.pageX : document.body.scrollLeft+*event*.clientX

Where is "event" defined? 'e' is passed to the "anddo()" function but I don't see where "event" is defined. Was "event" supposed to be 'e', by chance?

Peace...


----------



## dtpollock (Aug 14, 2005)

Hi Tomdkat

Sorry mate, but I have no idea what you're talking about. I simply went to http://www.htmlbasix.com/mousetrails.shtml

I set Speed of Trail to 10
I set Spacing of Letters to 10
I set Font Colour to White and Font Size to 9
I then hit Generate, and it spat out the code for me.

I just cut and pasted the code where necessary, so I have no idea what it should be. Again, if you can offer any suggestions, that'd be great.

Cheers


----------



## dtpollock (Aug 14, 2005)

Hi all

Sorry if I seem pushy here, but I'm still having problems with the Javascript in my site, and I need to get it sorted.

If anyone can help, please post back.

Cheers.


----------



## tomdkat (May 6, 2006)

Hey pal, take a number.  I haven't forgotten about you and I'll see what I can figure out and will post what I find in a few.

Peace...


----------



## tomdkat (May 6, 2006)

Sorry. There's some browser specific intricacies involved with the JavaScript and I don't have enough JavaScript knowledge to better diagnose what's going on.

DynamicDrive has a number of mouse trails and some work with Firefox and some don't and I don't know why.

Maybe you need to find a different mouse trail script.

Peace...


----------

