Enjoy an ad free experience by logging in. Not a member yet?
Register .
12-06-2006, 11:52 PM
PM User |
#1
New to the CF scene
Join Date: Dec 2006
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Floating menu doesn't work with DOCTYPE
Hy guys I use a simple floating menu javascript ... the problem is when I use the
Code:
<!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
the js :
Code:
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
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
and sorry 4 my bad english
12-07-2006, 05:50 AM
PM User |
#2
Regular Coder
Join Date: Mar 2006
Posts: 708
Thanks: 30
Thanked 127 Times in 118 Posts
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...
12-07-2006, 03:37 PM
PM User |
#3
Regular Coder
Join Date: Oct 2006
Posts: 107
Thanks: 3
Thanked 5 Times in 5 Posts
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">
12-07-2006, 04:46 PM
PM User |
#4
Supreme Master coder!
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
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.
__________________
|||| If you are getting paid to do a job, don't ask for help on it! ||||
12-07-2006, 07:05 PM
PM User |
#5
New to the CF scene
Join Date: Dec 2006
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
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/a...p/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
12-07-2006, 08:29 PM
PM User |
#6
Regular Coder
Join Date: Jun 2002
Location: Atlanta, GA.
Posts: 313
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
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
Code:
GetElements.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
to this
Code:
GetElements.y = ns ? pageYOffset + innerHeight : document.documentElement && document.documentElement.scrollTop ?
document.documentElement.scrollTop + document.documentElement.clientHeight : document.body.scrollTop + document.body.clientHeight;
12-07-2006, 08:49 PM
PM User |
#7
New to the CF scene
Join Date: Dec 2006
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
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
Code:
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!
12-07-2006, 08:55 PM
PM User |
#8
Regular Coder
Join Date: Jun 2002
Location: Atlanta, GA.
Posts: 313
Thanks: 0
Thanked 0 Times in 0 Posts
Had to make some more changes, here is the complete code
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();
12-07-2006, 09:01 PM
PM User |
#9
Regular Coder
Join Date: Jun 2002
Location: Atlanta, GA.
Posts: 313
Thanks: 0
Thanked 0 Times in 0 Posts
OK, I found that the menu comes from here so I guess you got a web templeate from them ?
http://www.allwebco-templates.com/su...t_floating.htm
You might want to contact them with the updated Float Menu script that now works with DOCTYPE.
12-07-2006, 09:02 PM
PM User |
#10
New to the CF scene
Join Date: Dec 2006
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
man thanks u are great !!!
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
Last edited by abyse; 12-07-2006 at 09:13 PM ..
12-07-2006, 10:08 PM
PM User |
#11
Regular Coder
Join Date: Jun 2002
Location: Atlanta, GA.
Posts: 313
Thanks: 0
Thanked 0 Times in 0 Posts
Try this
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 = 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();
12-07-2006, 10:14 PM
PM User |
#12
New to the CF scene
Join Date: Dec 2006
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
many thaks 2 you man !
I will contact the allwebco-templates 4 the new updated version
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 08:14 PM .
Advertisement
Log in to turn off these ads.