Conflicting scripts

W

webmaster

I am using two scripts (menus from milonic.com and a rotating news
script we have used successfully for many years) on our website
(www.imca-int.com) that independently work fine but together lead to
the following error:

Line: 20
Error: 'pageX' is null or not an object

While I can use scripts, I'm not tech-savvy enough to troubleshoot
them - can anyone assist?

Thanks,


Adam
 
S

Stevo

I am using two scripts (menus from milonic.com and a rotating news
script we have used successfully for many years) on our website
(www.imca-int.com) that independently work fine but together lead to
the following error:
Line: 20
Error: 'pageX' is null or not an object

While I can use scripts, I'm not tech-savvy enough to troubleshoot
them - can anyone assist?

Some strange stuff going on there. In the file mmenudom.js there's a
function called gMY which takes an object e as a parameter. Firstly,
it's being called with no parameter, so whatever it tries to do on the
object e is going to fail unless defensive coding first checks if e
exists (which it doesn't). The statement that's failing is doing
X_=e.pageX; which fails because e doesn't exist. Secondly, that
particular line of code should only be run if(ns6), which I assume means
if netscape6. That line was executing on my IE7. To stop the JS error I
could tell you to check if e exists, but there's more wrong than that.
Firstly, what's with the ns6 check, secondly, why is gMY being called
without an e object. I'm assuming it's meant to be an event that should
be passed.
 
E

Evertjan.

wrote on 19 aug 2008 in comp.lang.javascript:
I am using two scripts (menus from milonic.com and a rotating news
script we have used successfully for many years) on our website
(www.imca-int.com) that independently work fine but together lead to
the following error:

Line: 20
Error: 'pageX' is null or not an object

While I can use scripts, I'm not tech-savvy enough to troubleshoot
them - can anyone assist?

They seem to make use of the same names in the global space,
being bad scripting if you do not write scripts only for yourself.

Our christal balls are offline or the indefinite future.

Seems there are 4 solutions left:

1- Learn Javascript. [a joyfull experience in itself]

2- Hire a programmer, or bribe your next door wizkid.

3- Do not use the two scripts on the same page.

4- Use one of the two in an iframe. [needs 1 or 2]
 
L

Laser Lips

The reason your scripts are conflicting is indeed because of the
points made above, but fundamentally because they share the use of the
variable 'ns6'. They both try and set this variable to a value which
they each understand, but they both have different values. So you’re
bound to get inconsistencies. Try a global replace in on of the
scripts of 'ns6' to 'milons6' or somthing and see if that helps. You
may also want to look for other variables which use the same name.

Graham...
 
W

webmaster

Thanks guys, much appreciated - have fixed the immediate problem of an
IE script error coming up but will look at it in more detail in due
course. Completely agree the best thing is to learn javascript and I
hope to start on that in the near future, but needed a quicker fix
than I could have managed.

Cheers,


Adam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top