...

View Full Version : Floating menu doesn't work with DOCTYPE



abyse
12-06-2006, 11:52 PM
Hy guys I use a simple floating menu javascript ... the problem is when I use the
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> doctype the floating menu not working ... and without doctype working fine :confused:

the js :
if (!document.layers)
document.write('<div id="Floater" style="position:absolute">')
document.write('<layer id="Floater">');

document.write('<a href="index.php"><img src="icon_home.gif" alt="Home" title="Home" border="0" vspace="1"></a><br>');

document.write('<a href="news.php"><img src="icon_news.gif" alt="News" title="News" border="0" vspace="1"></a><br>');

document.write('<a href="downloads.php"><img src="icon_downloads.gif" alt="Downloads" title="Downloads" border="0" vspace="1"></a><br>');

document.write('<a href="games.php"><img src="icon_games.gif" border="0" alt="Games" title="Games" vspace="1"></a><br>');

document.write('<a href="chat.php"><img src="icon_chat.gif" border="0" alt="Chat" title="Chat" vspace="1"></a><br>');

document.write('<a href="add.php"><img src="icon_addurl.gif" border="0" alt="Add Site" title="Add Site" vspace="1"></a><br>');

document.write('<a href="contact.php"><img src="icon_contact.gif" alt="Contact" title="Contact" border="0" vspace="1"></a><br>');

document.write('<a href="search.php"><img src="icon_search.gif" border="0" alt="Search" title="Search" vspace="1"></a><br>');

document.write('<a href="javascript:self.scrollTo(0,0);"><img src="icon_top.gif" border="0" alt="Top" title="Top" vspace="1"></a><br>');

document.write('</layer>');

if (!document.layers)
document.write('</div>')

function FloatMenu()
{
var Xloc = 0;
Yloc = 335;
var ns = (navigator.appName.indexOf("Netscape") != -1);
function SetMenu(id)
{
var GetElements=document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers[id];
if(document.layers)GetElements.style=GetElements;
GetElements.sP=function(x,y){this.style.right=x;this.style.top=y;};
GetElements.x = Xloc;
GetElements.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
GetElements.y -= Yloc;
return GetElements;
}
window.LoCate_XY=function()
{
var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
ftlObj.y += (pY - Yloc - ftlObj.y)/15;
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("LoCate_XY()", 10);
}
ftlObj = SetMenu("Floater");
LoCate_XY();
}
FloatMenu();

see a live example : http://www.abysesoft.evonet.ro/in_testing.php

please help me to fix this problem I wana see working this script with
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

and sorry 4 my bad english :o

mrhoo
12-07-2006, 05:50 AM
layers don't validate in html4-try an html3 doctype, or leave it off if you insist on them.
Somebody must still be using Netscape 4...

rubenbuhr
12-07-2006, 03:37 PM
I found that doctype tag awhile ago and had too much trouble with it.

I only start with this now;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

_Aerospace_Eng_
12-07-2006, 04:46 PM
Using a full valid doctype (which btw ruben you aren't) you must use units when specifying values such as top, left, height, and width.

abyse
12-07-2006, 07:05 PM
so dont exist any solution only removing the doctype "http://www.w3.org/TR/html4/loose.dtd"> ? :(

i know a floating menu .. working whit any doctype : http://www.dynamicdrive.com/forums/archive/index.php/t-13239.html

can somebody explain me how can i modify my floating menu to work with any doctype like that

again sorry for my english :(

RoyW
12-07-2006, 08:29 PM
can somebody explain me how can i modify my floating menu to work with any doctype like that
Well, seeing as I saw that menu script on another site (can't find it now) and they had thier own copyright info on it, and the script is obviously copied and slightly modified version of the DD script I am not sure how you can call it "my floating menu".

Anyway, seeing as that is a way old script and one I no longer promote, here is a fix :-
Change this line


GetElements.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;

to this


GetElements.y = ns ? pageYOffset + innerHeight : document.documentElement && document.documentElement.scrollTop ?
document.documentElement.scrollTop + document.documentElement.clientHeight : document.body.scrollTop + document.body.clientHeight;

abyse
12-07-2006, 08:49 PM
yes man u are right "not my floating menu" ... is just mine when I using the script (im not the autor 4 that fl menu) ... and that script is not from dynamic drive ... I changed the code but is not working :(


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

document.write('<a href="index.php"><img src="icon_home.gif" alt="Home" title="Home" border="0" vspace="1"></a><br>');

document.write('<a href="news.php"><img src="icon_news.gif" alt="News" title="News" border="0" vspace="1"></a><br>');

document.write('<a href="downloads.php"><img src="icon_downloads.gif" alt="Downloads" title="Downloads" border="0" vspace="1"></a><br>');

document.write('<a href="games.php"><img src="icon_games.gif" border="0" alt="Games" title="Games" vspace="1"></a><br>');

document.write('<a href="chat.php"><img src="icon_chat.gif" border="0" alt="Chat" title="Chat" vspace="1"></a><br>');

document.write('<a href="add.php"><img src="icon_addurl.gif" border="0" alt="Add Site" title="Add Site" vspace="1"></a><br>');

document.write('<a href="contact.php"><img src="icon_contact.gif" alt="Contact" title="Contact" border="0" vspace="1"></a><br>');

document.write('<a href="search.php"><img src="icon_search.gif" border="0" alt="Search" title="Search" vspace="1"></a><br>');

document.write('<a href="javascript:self.scrollTo(0,0);"><img src="icon_top.gif" border="0" alt="Top" title="Top" vspace="1"></a><br>');

document.write('</layer>');

if (!document.layers)
document.write('</div>')

function FloatMenu()
{
var Xloc = 0;
Yloc = 335;
var ns = (navigator.appName.indexOf("Netscape") != -1);
function SetMenu(id)
{
var GetElements=document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers[id];
if(document.layers)GetElements.style=GetElements;
GetElements.sP=function(x,y){this.style.right=x;this.style.top=y;};
GetElements.x = Xloc;
GetElements.y = ns ? pageYOffset + innerHeight : document.documentElement && document.documentElement.scrollTop ?
document.documentElement.scrollTop + document.documentElement.clientHeight : document.body.scrollTop + document.body.clientHeight;
GetElements.y -= Yloc;
return GetElements;
}
window.LoCate_XY=function()
{
var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
ftlObj.y += (pY - Yloc - ftlObj.y)/15;
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("LoCate_XY()", 10);
}
ftlObj = SetMenu("Floater");
LoCate_XY();
}
FloatMenu();

see here : http://www.abysesoft.evonet.ro/in_testing.php

:(

anyway thanks for the help ... if you hawe other nice ideas please help!

RoyW
12-07-2006, 08:55 PM
Had to make some more changes, here is the complete code



/**
* Adapted from original script at http://www.dynamicdrive.com/dynamicindex1/staticmenu.htm
*/
if (!document.layers)
document.write('<div id="Floater" style="position:absolute">')
document.write('<layer id="Floater">');

document.write('<a href="index.php"><img src="http://www.abysesoft.evonet.ro/icon_home.gif" alt="Home" title="Home" border="0" vspace="1"></a><br>');

document.write('<a href="news.php"><img src="http://www.abysesoft.evonet.ro/icon_news.gif" alt="News" title="News" border="0" vspace="1"></a><br>');

document.write('<a href="downloads.php"><img src="http://www.abysesoft.evonet.ro/icon_downloads.gif" alt="Downloads" title="Downloads" border="0" vspace="1"></a><br>');

document.write('<a href="games.php"><img src="http://www.abysesoft.evonet.ro/icon_games.gif" border="0" alt="Games" title="Games" vspace="1"></a><br>');

document.write('<a href="chat.php"><img src="http://www.abysesoft.evonet.ro/icon_chat.gif" border="0" alt="Chat" title="Chat" vspace="1"></a><br>');

document.write('<a href="add.php"><img src="http://www.abysesoft.evonet.ro/icon_addurl.gif" border="0" alt="Add Site" title="Add Site" vspace="1"></a><br>');

document.write('<a href="contact.php"><img src="http://www.abysesoft.evonet.ro/icon_contact.gif" alt="Contact" title="Contact" border="0" vspace="1"></a><br>');

document.write('<a href="search.php"><img src="http://www.abysesoft.evonet.ro/icon_search.gif" border="0" alt="Search" title="Search" vspace="1"></a><br>');

document.write('<a href="javascript:self.scrollTo(0,0);"><img src="http://www.abysesoft.evonet.ro/icon_top.gif" border="0" alt="Top" title="Top" vspace="1"></a><br>');

document.write('</layer>');

if (!document.layers)
document.write('</div>')

function FloatMenu()
{
var Xloc = 0;
Yloc = 500;
var ns = (navigator.appName.indexOf("Netscape") != -1);
function SetMenu(id)
{
var GetElements=document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers[id];
if(document.layers)GetElements.style=GetElements;
GetElements.sP=function(x,y){this.style.right=x+"px";this.style.top=y+"px";};
GetElements.x = Xloc;
GetElements.y = ns ? pageYOffset + innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.scrollTop + document.documentElement.clientHeight : document.body.scrollTop + document.body.clientHeight;
GetElements.y -= Yloc;
return GetElements;
}
window.LoCate_XY=function()
{
var pY = ns ? pageYOffset + innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.scrollTop + document.documentElement.clientHeight : document.body.scrollTop + document.body.clientHeight;
ftlObj.y += (pY - Yloc - ftlObj.y)/15;
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("LoCate_XY()", 10);
}
ftlObj = SetMenu("Floater");
LoCate_XY();
}
FloatMenu();

RoyW
12-07-2006, 09:01 PM
OK, I found that the menu comes from here so I guess you got a web templeate from them ?
http://www.allwebco-templates.com/support/S_script_floating.htm

You might want to contact them with the updated Float Menu script that now works with DOCTYPE.

abyse
12-07-2006, 09:02 PM
man thanks u are great !!! :thumbsup:

:o but its valid works in ie 7, ie 6 firefox ... but in opera :( no the menu is too down

here is a screen shot if you dont use opera http://img211.imageshack.us/img211/3571/capture4mf6.jpg

RoyW
12-07-2006, 10:08 PM
Try this



/**
* Adapted from original script at http://www.dynamicdrive.com/dynamicindex1/staticmenu.htm
*/
if (!document.layers)
document.write('<div id="Floater" style="position:absolute">')
document.write('<layer id="Floater">');

document.write('<a href="index.php"><img src="http://www.abysesoft.evonet.ro/icon_home.gif" alt="Home" title="Home" border="0" vspace="1"></a><br>');

document.write('<a href="news.php"><img src="http://www.abysesoft.evonet.ro/icon_news.gif" alt="News" title="News" border="0" vspace="1"></a><br>');

document.write('<a href="downloads.php"><img src="http://www.abysesoft.evonet.ro/icon_downloads.gif" alt="Downloads" title="Downloads" border="0" vspace="1"></a><br>');

document.write('<a href="games.php"><img src="http://www.abysesoft.evonet.ro/icon_games.gif" border="0" alt="Games" title="Games" vspace="1"></a><br>');

document.write('<a href="chat.php"><img src="http://www.abysesoft.evonet.ro/icon_chat.gif" border="0" alt="Chat" title="Chat" vspace="1"></a><br>');

document.write('<a href="add.php"><img src="http://www.abysesoft.evonet.ro/icon_addurl.gif" border="0" alt="Add Site" title="Add Site" vspace="1"></a><br>');

document.write('<a href="contact.php"><img src="http://www.abysesoft.evonet.ro/icon_contact.gif" alt="Contact" title="Contact" border="0" vspace="1"></a><br>');

document.write('<a href="search.php"><img src="http://www.abysesoft.evonet.ro/icon_search.gif" border="0" alt="Search" title="Search" vspace="1"></a><br>');

document.write('<a href="javascript:self.scrollTo(0,0);"><img src="http://www.abysesoft.evonet.ro/icon_top.gif" border="0" alt="Top" title="Top" vspace="1"></a><br>');

document.write('</layer>');

if (!document.layers)
document.write('</div>')

function FloatMenu()
{
var Xloc = 0;
Yloc = 335;
var ns = (navigator.appName.indexOf("Netscape") != -1);
function SetMenu(id)
{
var GetElements=document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers[id];
if(document.layers)GetElements.style=GetElements;
GetElements.sP=function(x,y){this.style.right=x+"px";this.style.top=y+"px";};
GetElements.x = Xloc;
GetElements.y = ns ? pageYOffset + innerHeight : !window.opera && document.documentElement && document.documentElement.clientHeight ? document.documentElement.scrollTop + document.documentElement.clientHeight : document.body.scrollTop + document.body.clientHeight;
GetElements.y -= Yloc;
return GetElements;
}
window.LoCate_XY=function()
{
var pY = ns ? pageYOffset + innerHeight : !window.opera && document.documentElement && document.documentElement.clientHeight ? document.documentElement.scrollTop + document.documentElement.clientHeight : document.body.scrollTop + document.body.clientHeight;
ftlObj.y += (pY - Yloc - ftlObj.y)/15;
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("LoCate_XY()", 10);
}
ftlObj = SetMenu("Floater");
LoCate_XY();
}
FloatMenu();

abyse
12-07-2006, 10:14 PM
many thaks 2 you man ! :thumbsup: I will contact the allwebco-templates 4 the new updated version ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum