Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What does 'rootpath' is undifined mean?

    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
    Last edited by nath_dearn; 04-28-2004 at 04:22 PM. Reason: Changing title question.

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    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
    Helping to build a bigger box. - Adam Matthews

  • #3
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Last edited by nath_dearn; 04-28-2004 at 06:04 PM. Reason: typing errors

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    And if you look at that javascript you'll see the following function:

    Code:
    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.
    Last edited by Roy Sinclair; 04-28-2004 at 07:16 PM.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #5
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Thank you my friend

    Cheers very much, it worked, I'll post the address soon so you can see what you have helped with.

    Thanks again

    Nathan
    Last edited by nath_dearn; 04-29-2004 at 05:07 PM. Reason: daft fingers


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •