PDA

View Full Version : Script not working in folders



bjensen
10-25-2004, 08:13 PM
We had our website designed for us using your 'AnyLink Drop Down Menu'. The entire site is created in css and they have created a few pages for me to work with, one for example called doc.html. The flyout works great if all files path are in the same directory.

Example: I opened a 'sample' doc.html which is sitting inside the main folder into a sub-folder down and re-named the file doc1.html. A pop up window came up asking to update links. The paths connected correctly to all the other files. When I viewed the document in the browser everything looked great except for the flyout navigation.

The designers are saying the following:

- it looks like detect.js is writing in script links that aren't absolute
- and in the configpc.js file, it looks like the images aren't preceded with a slash either, which may cause trouble
- we don't recommend remapping links

How do I make the detect.js file write in scripts that aren't absolute? The designers aren't assisting me with this at all.

Here is the code in the .js files that works if the files are not in sub-folders? I have tried changing the paths but nothing works.

----------------------------------------
This is the code from configpc.js files

function init()
{
menus[0] = new menu(46, "horizontal", 122, 0, 0, 0, "img:../images/background1.jpg", "img:images/background2.jpg", "Arial,Helvetica", 9, "bold", "bold", "white", "white", 0, "white", 0, "rollover:../images/tri-down1.gif:images/tri-down2.gif", false, false, true, false, 0, false, 4, 4, "gray");

menus[0].addItem("#", "_blank", 138, "center", "rollover:../images/nav_members.jpg:images/nav_members_ovr.jpg", 1);

---------------------------------

detect.js file

// JavaScript Document
var browser_used=navigator.userAgent.toLowerCase();

var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_ie = (browser_used.indexOf("msie") != -1);
var is_mac = (browser_used.indexOf("mac")!=-1);


var is_ie5 = (is_ie && (is_major == 4) && (browser_used.indexOf("msie 5.0")!=-1) );

var is_nav = ((browser_used.indexOf('mozilla')!=-1) && (browser_used.indexOf('spoofer')==-1)
&& (browser_used.indexOf('compatible') == -1) && (browser_used.indexOf('opera')==-1)
&& (browser_used.indexOf('webtv')==-1));

if (is_mac)
{
// detect if ie5

if(is_ie5)
{
document.write("<script type='text/javascript' src='configmine.js'></script>");
}
else
{
// if not load mac
document.write("<script type='text/javascript' src='configmine.js'></script>");
}
}
else
{
// if not mac then

if(is_ie)
{
// if ie5
document.write("<script type='text/javascript' src='configpc.js'></script>");
}
else
{
// else if netscape or opera
document.write("<script type='text/javascript' src='configpc.js'></script>");
}


}

Any assistance would be greatly appreciated.
bjensen

cr3ative
10-26-2004, 06:57 AM
This is an example of absolute linking:

http://www.webhost.com/webfolder/webimage.gif

And this is an example of relative linking:

/webfolder/webimage.gif


cr3ative