...

View Full Version : 'rootpath' is undifined????



nath_dearn
04-28-2004, 04:16 PM
Hello people,

Ok so I have a javascript problem. I have a page with a text link, when the mouse moves over the text link a small image to left of the link changes to another image of a different colour ( or atleast its supposed to) im getting the runtime error - 'rootpath' is undefined. Below is the javascript im using. The script is in a seperate file thats linked to the code ie

<SCRIPT language=JavaScript
src="Images/AW_scripts_ProjectSpecific.js">
</SCRIPT>

JAVASCRIPT CODE
//--------------------------------------------------------------
function awChangeBGColor(ID, color)
{
if (document.all) {
document.all[ID].style.backgroundColor = color;
return;
}
if (document.getElementById) {
document.getElementById(ID).style.backgroundColor = color;
return;
}
}

//--------------------------------------------------------------
function awCnangeImage(ID, imgPath)
{
if (document.images) {
imgFile = rootpath + imgPath;
document[ID].src = imgFile;
}
}
CODE END

I dont know what the rootpath is supposed to be defined as nor do I know what it reffers to, what is the rootpath?

Here is an example page with the error message:
http://www.extraordinarydesigns.co.uk/test/

Thank you for any help you maybe able to offer me on this problem,

Nathan

Basscyst
04-28-2004, 05:01 PM
Looks like rootpath is probably a variable in the js file. (AW_scripts_ProjectSpecific.js) Post or attach the JS file as well and you will get a better response to your question.

Basscyst

nath_dearn
04-28-2004, 06:03 PM
the javascript code I included is actually the code from the 'AW_scripts_ProjectSpecific.js' file. All the code I am using is above or can be found on the example page.

Nathan

Roy Sinclair
04-28-2004, 07:12 PM
And if you look at that javascript you'll see the following function:



function awCnangeImage(ID, imgPath)
{
if (document.images) {
imgFile = rootpath + imgPath;
document[ID].src = imgFile;
}
}


As noted, it's a variable which isn't defined anywhere else on the page.

From the look of things you could probably just remove the reference to rootpath from the JS file and things would work just fine.

nath_dearn
04-29-2004, 05:06 PM
Cheers very much, it worked, I'll post the address soon so you can see what you have helped with.

Thanks again

:) :) :) Nathan :) :) :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum