PDA

View Full Version : AnyLink Vertical Menu - Please help!!



Mythor
07-12-2006, 10:44 AM
1) Script Title: AnyLink Vertical Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/anylinkvertical.htm

3) Describe problem: I have posted this problem before, but received no response. So I have uploaded the relevant pages to my website, so some kind soul out there can see what happens with this drop down menu. The page can be found at: http://www.sgconsulting.co.za/Testsite/Index.htm

The menu looks fine and works fine when I use the drop down to navigate to other pages. The problem comes when I try to move away from the target page. Part of its address becomes inserted into the URL of the next page one tries to move to, making all further navigation impossible.

Does anyone have any idea what is causing this? I assume I screwed up the code in the AnyLink Menu somehow, but I simply don't know enough about coding to figure out where the fault lies.

Pleeeeeeease Help!!!!:confused:

jscheuer1
07-13-2006, 07:49 AM
That problem is because you are using the relative path in the menu code, example:

menu1[0]='<a href="Products/BatchMixer/BatchMixer.htm">Batch Mixing</a>'

which is fine if you are in the /Testsite/ directory because there it means:

/Testsite/Products/BatchMixer/BatchMixer.htm

but if you are already in, say - the /Testsite/Products/Reactor/ directory, it means:

/Testsite/Products/Reactor/Products/BatchMixer/BatchMixer.htm

which doesn't exist. Now I don't know how the menu code is getting on those pages, if it is via an include of some sort, best to use the absolute path:

menu1[0]='<a href="http://www.sgconsulting.co.za/Testsite/Products/BatchMixer/BatchMixer.htm">Batch Mixing</a>'

If it is hard coded onto each page, you can still use the absolute path or, just make sure each link does point to a real page.

Now, you have another problem that you may not even be aware of. Only a Microsoft product like IE or Word, etc. knows what this means:


<!--[if !mso]>

To all other browsers it looks like the beginning of an ordinary HTML comment. This would be fine except that everything after that until this:


<![endif]-->

gets skipped so, your menu that could work in other browsers will not.

Mythor
07-13-2006, 10:48 AM
Thank you very much, John. I will alter the addresses and see if that gives me any joy.

I thought that the microsoft coding is in the script to allow it to work with IE. The way I understood the explaination of the coding, this part is ignored by other browsers, but has to be read by IE to allow the menu to work properly.
Did I misunderstand this?

Cheers

Nils

jscheuer1
07-13-2006, 04:32 PM
Well, you have the right idea about conditional comments but you have implemented it in a way that, though logical for MS products, will result in exactly the situation I described in all other browsers.

The mistake you've made is in shielding one MS application from the code and allowing another MS application access to the code inside the conditional. This works fine as long as only programs that understand the condition are used with the file. However, of all the browsers in use today only IE4 and above understand the condition.

The way the conditional is supposed to be used for live HTML pages is to allow IE (sometimes only certain versions of IE) and deny all others access to a code segment.

What you have breaks down like so in IE:

IE is parsing the document, it sees:


<!--[if !mso]>

It 'thinks' - Um this is a comment, oh no it is a conditional comment, let's see it says "If you are not MS Office, read the following code", OK, I'm not MS Office, so I'll read this code.

Then when it gets to:


<![endif]-->

IE goes like - Phew, now I don't have to worry about wether or not I am MS Office, I can just proceed normally.

However, all other browser do it this way:

When they get to the first one, they think - ah, a comment, I'll stop reading until the comment is closed.

Then when they get to the second one - time to start reading again.

Mythor
07-14-2006, 11:47 AM
Hi again, John

Thanks again for your help.

OK, clear as mud so far - that sound you hear is my head bouncing repeatedly off my desk.

I have checked the code for the menu as I originally set it up, and compared it to that which appears on the pages I copied it to. The <!--[if !mso]> part does not appear in the original menu, so I can only assume that it is something added in by Front Page. I certainly don't know enough about this to have done it on purpose :-)).

Can I simply delete the code segments or am I totally screwed here?

Cheers

Nils

jscheuer1
07-14-2006, 03:26 PM
FP has a habit of doing that sort of thing. That's one reason why I use a text editor to do coding. If you are going to load the page into FP ever again at any time, best to open it up first in notepad and replace:


<!--[if !mso]>

with:


<!--webbot bot="HTMLMarkup" startspan -->

and replace:


<![endif]-->

with:


<!--webbot bot="HTMLMarkup" endspan -->

and save. That way FP won't mess with that part anymore and all browsers will read the code between them as, these new comments appear as two separate, self contained comments.

Mythor
07-16-2006, 08:54 AM
Right! Looks like I have some work to do. Great to find someone who knows what he is doing and is prepared to help. Thanks a stack!