View Full Version : IE doesn't like my variable!!
I am trying to use the snow/leaves script (found at: http://www.dynamicdrive.com/dynamicindex3/leaves.htm)
on my page, but I cannot get it to work in IE - it says that there is an error with the P variable and that I might already have one on my page.
Is it just a case of replacing all instances of the P variable to another letter? I'm not very experienced in JScript, so any help will be much appreciated!
I've attached the file if you're interested!!
ShriekForth
10-01-2002, 04:19 PM
Do you have other scripts on the page? One that might be using P as a variable? If so I would just change that one. The script at dynamic drive uses P to select which "leaf" image to use. If you have a P in another script, it could throw this error. I would not get carried away with a find/replace all. You will probably end up in the same boat with a different variable name.
ShriekForth
adios
10-01-2002, 04:44 PM
IE.....says that there is an error with the P variable and that I might already have one on my page.
I'd like to see that error message...:confused:
adios
Hi adios,
Dreamweaver's debugging tool for IE says
Line 304, Warning 5001, Description: global variable "P" already defined in global scope
Also, when I load the page in IE and am asked to debug - I get that line.
An exception of type 'Microsfot JScript runtime error: Object doesn't support this property or method" was not handled
Eski
RadarBob
10-02-2002, 01:15 PM
Remember:
Whenever you create a new variable inside of a function without the "var", you are making a global variable.
So if this new inside-the-function variable has the same name as an existing global variable, all you're doing is changing the value of the global variable.
P.S. A variable defined outside of any function is still a global variable, even when using "var".
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.