View Full Version : Anylink and Floating - Doc Type?

11-20-2008, 03:30 AM
1) Script Title: AnyLink Drop Down Menu (orAnyLink CSS Menu) and Floating Menu Script

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

3) Describe problem: The DOC TYPE Kills these! This should be easy. When these two scripts are on the same page they work fine until I add a DocType. I am using;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">

Yes I have tried all the ones here at DD. http://alistapart.com/articles/doctype Same result.

I created two simple pages. One using Anylink CSS (http://abswood.com/dynamic/anylink_float_html.htm) and the second using Anylink dropdown (http://abswood.com/dynamic/anylinkJS_floating.htm).

1) They both work fine without the DOCTYPE :) just remove that line
2) They both work individually with the DOCTYPE :)
3) They do not work together with the DOCTYPE :mad:

Together these will add great functionality. I presently use the Floating with Popit Menu and they integrate beautifully. However the Anylink is preferred as it formats more professionally at a predetermined point not obscuring the anchor points.

Any suggestions would be welcome.

Thanks in advance,

11-21-2008, 04:40 AM
Actually, from what I can tell, the Floating Menu script doesn't work when a doctype is specified, period. Whether or not Anylink Menu is defined on the same page is irrelevant. Try the below modified script for Floating Menu script:

if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')

<layer id="divStayTopLeft">

<table border="1" width="130" cellspacing="0" cellpadding="0">
<td width="100%" bgcolor="#FFFFCC">
<p align="center"><b><font size="4">Menu</font></b></td>
<td width="100%" bgcolor="#FFFFFF">
<p align="left"> <a href="http://www.dynamicdrive.com">Dynamic Drive</a><br>
<a href="http://www.dynamicdrive.com/new.htm">What's New</a><br>
<a href="http://www.dynamicdrive.com/hot.htm">What's Hot</a><br>
<a href="http://www.dynamicdrive.com/faqs.htm">FAQs</a><br>
<a href="http://www.dynamicdrive.com/morezone/">More Zone</a></td>
<!--END OF EDIT-->


<script type="text/javascript">

Floating Menu script- Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use

//Enter "frombottom" or "fromtop"
var verticalpos="frombottom"

var fstandardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body

if (!document.layers)

function JSFX_FloatTopDiv()
var startX = 3,
startY = 250;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
el.y = ns ? window.pageYOffset + window.innerHeight : fstandardbody.scrollTop + fstandardbody.clientHeight;
el.y -= startY;
return el;
if (verticalpos=="fromtop"){
var pY = ns ? window.pageYOffset : document.body.scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
var pY = ns ? window.pageYOffset + window.innerHeight : fstandardbody.scrollTop + fstandardbody.clientHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
ftlObj = ml("divStayTopLeft");

It should take care of the doctype issue, though note that this is a very old script, and there are a few other things that could use modification. I can only do that when I officially get to updating this script.

11-23-2008, 05:39 PM
Hi DDAdmin,

Thanks for your quick reply. I tried implementing it immediately upon your posting it.

I am going absolutely crazy. I have worked evenings, Saturday and this morning. I think the problem is in AnyLink. I am sure that lots of people use AnyLink with Float as they seem a natural fit. I am just not sharp enough to see why I cannot make them work. All the other DD code works great.

Original Problem: The AnyLink dropdowns looks their color when I add the DocType.

Let me be very specific as to the problem. With the original Float and Popit, the scripts worked beautiful just the positioning of Popit is annoying. Live Example: http://abswood.com/index.htm, just scroll up and down and mouse over to see the functionality.

Add AnyLink with Original Float & DocType: I added the Anylink (and removed everything else) and the Original float and Anylink seem to work, BUT the dropdowns loose their color clues. Example: http://abswood.com/pages/stand alone working anylink with orig float.htm

It seems like whenever I use AnyLink is where the problem occurs. BTW: I like the original Float as it allows me to position it via the top right cornor. If AnyLink dropdowns worked it would be my prefered solution. Just getting the color to work.

History: As you can imagine I have many variations trying to get this to work. I only included a few important ones. The two below show the new Float code. The first shows it works with Anylink including the colored dropdowns. In the second I add the Doctype and kablowy. That is why I think it is in AnyLink as both Float codes do the same thing with the common factor being AnyLink.

:) AnyLink with New Float No Doc Type: http://abswood.com/pages/stand alone working anylink add new float.htm Works like a champ. Moves and Colored dropdowns.

:mad: Anylink with new Fload ADD DocType: http://abswood.com/pages/stand alone non-working anylink add new float with doc type.htm Neither Movement or Dropdown works.

11-25-2008, 09:26 AM
Wait, are you actually trying to put Anylink menu inside of Floating menu, so the anchor links for the later are contained inside the later? Not sure if that changes anything, but I was under the assumption you were simply trying to get these two scripts to run on the same page, separately as far as integration.

11-27-2008, 01:24 AM
Hi DDAdmin,

I could not make the scrips work so as karma would have it, I just went with another solution. I am still using the original float as it worked very well. I then used the Apple Accordian menu that now floats down an open track. Looks very professional and modern.

Thanks again for all your help as I would not have had such wonderful solutions and tools without you.