PDA

View Full Version : AnyLink JS Drop Down Menu v2.3



andywalmsley
11-25-2012, 02:25 PM
1) AnyLink JS Drop Down Menu v2.3 2) http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm Hi, I'm using the drop down menu script, above, for the first time and want to incorporate a menu within a template so as to replicate the facility across all related website pages. It works fine with absolute paths, but not with relative paths - prefixed ../ Can anybody help? Andrew

Beverleyh
11-25-2012, 03:49 PM
Can you explain what exactly isnt working with relative paths - relatives paths where? In the js or the anchor links in your HTML? Are you sure the relative page location is correct and pages are uploaded?

Lots of things could be the issue so please post the link to your page as it will be easier to pinpoint the problem.

andywalmsley
11-25-2012, 04:25 PM
Can you explain what exactly isnt working with relative paths - relatives paths where? In the js or the anchor links in your HTML? Are you sure the relative page location is correct and pages are uploaded?

Lots of things could be the issue so please post the link to your page as it will be easier to pinpoint the problem.

Hi Beverley,
Thanks for the speedy response.
The relative paths are in the js, as follows:


var anylinkmenu1={divclass:'anylinkmenu', inlinestyle:'', linktarget:''} //First menu variable. Make sure "anylinkmenu1" is a unique name!
anylinkmenu1.items=[
["Ecology and Conservation", "../services/ecology_and_cnservation/ecology_and_cons_services.html"],
["Green Infrastructure", "../services/green_infrastructure/green_infrastructure.html"],
["Recreation and Open Spaces", "../services/recreation_and_open_spaces/recreation_and_open_spaces.html"] //no comma following last entry!
]

All the downloaded scripts are in the root directory.
The site has not been loaded yet, as it's still in development.
I'm previewing the pages in IE - there's a facility to allow scripts to run.

(Oddly, the links occasionally work ok, but usually return the message: Oops, the page you are looking for could not be found).

The anchor link code on the page is largely as it started:

<p><a href="http://www.dynamicdrive.com" class="menuanchorclass" rel="anylinkmenu1">Consultancy Services</a></p>

(I assume that I should change the reference to dynamicdrive to my own website url, when the site is loaded).

Thanks again,
Andrew

Beverleyh
11-25-2012, 04:35 PM
Ok, so what exactly isn't working? What happens when you click the main anchor link? What happens when you click the drop down links? Does a web page open but just not display the content? Have you tried setting up the script on a blank page? Does that work as expected? Are there other scripts on the page that could be interfering?

Please try to be as specific as possible and also upload your pages to provide a working link - if you don't want to give us a final link address, please provide page links from a temporary test location.

andywalmsley
11-25-2012, 05:15 PM
Ok, so what exactly isn't working? What happens when you click the main anchor link? What happens when you click the drop down links? Does a web page open but just not display the content? Have you tried setting up the script on a blank page? Does that work as expected? Are there other scripts on the page that could be interfering? Please try to be as specific as possible and also upload your pages to provide a working link - if you don't want to give us a final link address, please provide page links from a temporary test location.

Hi Beverley,

I hope that the following makes sense.

When the main anchor link is clicked, the Dynamic Dive home page is displayed - presumably because I've not changed the anchor link code.

I've just done a little more testing and realise that links on pages immediatly below the root directory work ok, but those on pages further down the structure do not work, nor do those on the home page. Those that do work are on pages at exactly the same level as the template page where the anchor link was specified - a coincidence?

The structure is:
Site
About us - folder and page
Contact us - folder and page
Services - folder
Ecology and Conservation - folder
Assessment - folder and page
Biodiversity - folder and page
Template - folder and page
Etc

So the links work ok on the About us and Contact us pages, but not on others.

Those not working return a page with a message saying 'Oops, the page you are looking for could not be found'.

There are no other srcipts on the page.

Sorry, I don't currently have facilities to load the pages.

Hope this helps.
Andrew

Beverleyh
11-25-2012, 05:48 PM
I think what you're describing is that relative links dont work on a template page because there not always relative once you move around sub folders? They break. Unfortunately there's no easy work around for that.

You can format an absolute link like this: "/about/page.html" too.

The slash at the start tells the script to always start from the root, without actually specifying the domain (without the http://mywebsite.com part.)

I don't imagine this will work on a local computer though - you'll need to upload it to see it working. Alternatively you can run a server environment on your computer for testing. Try http://www.server2go-web.de/

andywalmsley
11-25-2012, 05:53 PM
Thanks Beverley, that makes sense.
Presumably there is no disadvantage in using full, absolute addresses - is there?
Andrew

Beverleyh
11-25-2012, 06:03 PM
Only in the sense that they lose portability (as you've found out) and they take a bit more effort to type. They otherwise function just the same.

andywalmsley
11-25-2012, 06:32 PM
Only in the sense that they lose portability (as you've found out) and they take a bit more effort to type. They otherwise function just the same.

Thanks again Beverley, for your help.
Andrew

Beverleyh
11-25-2012, 06:38 PM
Happy to help :)