Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-06-2006, 11:52 PM   PM User | #1
abyse
New to the CF scene

 
Join Date: Dec 2006
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
abyse is an unknown quantity at this point
Question 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
__________________
http://www.fileden.com/files/2674/abyse.gif
Feel The Power
abyse is offline   Reply With Quote
Old 12-07-2006, 05:50 AM   PM User | #2
mrhoo
Regular Coder

 
Join Date: Mar 2006
Posts: 708
Thanks: 30
Thanked 127 Times in 118 Posts
mrhoo will become famous soon enoughmrhoo will become famous soon enough
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...
mrhoo is offline   Reply With Quote
Old 12-07-2006, 03:37 PM   PM User | #3
rubenbuhr
Regular Coder

 
Join Date: Oct 2006
Posts: 107
Thanks: 3
Thanked 5 Times in 5 Posts
rubenbuhr is an unknown quantity at this point
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">
rubenbuhr is offline   Reply With Quote
Old 12-07-2006, 04:46 PM   PM User | #4
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 12-07-2006, 07:05 PM   PM User | #5
abyse
New to the CF scene

 
Join Date: Dec 2006
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
abyse is an unknown quantity at this point
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
__________________
http://www.fileden.com/files/2674/abyse.gif
Feel The Power
abyse is offline   Reply With Quote
Old 12-07-2006, 08:29 PM   PM User | #6
RoyW
Regular Coder

 
Join Date: Jun 2002
Location: Atlanta, GA.
Posts: 313
Thanks: 0
Thanked 0 Times in 0 Posts
RoyW is an unknown quantity at this point
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;
__________________
The answer does not come from thinking outside the box, it comes from realizing the truth :-
"There Is No Box". [JavaScript Gadgets'n'Gizmos][JavaScript-FX]
RoyW is offline   Reply With Quote
Old 12-07-2006, 08:49 PM   PM User | #7
abyse
New to the CF scene

 
Join Date: Dec 2006
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
abyse is an unknown quantity at this point
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!
__________________
http://www.fileden.com/files/2674/abyse.gif
Feel The Power
abyse is offline   Reply With Quote
Old 12-07-2006, 08:55 PM   PM User | #8
RoyW
Regular Coder

 
Join Date: Jun 2002
Location: Atlanta, GA.
Posts: 313
Thanks: 0
Thanked 0 Times in 0 Posts
RoyW is an unknown quantity at this point
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();
__________________
The answer does not come from thinking outside the box, it comes from realizing the truth :-
"There Is No Box". [JavaScript Gadgets'n'Gizmos][JavaScript-FX]
RoyW is offline   Reply With Quote
Old 12-07-2006, 09:01 PM   PM User | #9
RoyW
Regular Coder

 
Join Date: Jun 2002
Location: Atlanta, GA.
Posts: 313
Thanks: 0
Thanked 0 Times in 0 Posts
RoyW is an unknown quantity at this point
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.
__________________
The answer does not come from thinking outside the box, it comes from realizing the truth :-
"There Is No Box". [JavaScript Gadgets'n'Gizmos][JavaScript-FX]
RoyW is offline   Reply With Quote
Old 12-07-2006, 09:02 PM   PM User | #10
abyse
New to the CF scene

 
Join Date: Dec 2006
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
abyse is an unknown quantity at this point
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
__________________
http://www.fileden.com/files/2674/abyse.gif
Feel The Power

Last edited by abyse; 12-07-2006 at 09:13 PM..
abyse is offline   Reply With Quote
Old 12-07-2006, 10:08 PM   PM User | #11
RoyW
Regular Coder

 
Join Date: Jun 2002
Location: Atlanta, GA.
Posts: 313
Thanks: 0
Thanked 0 Times in 0 Posts
RoyW is an unknown quantity at this point
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();
__________________
The answer does not come from thinking outside the box, it comes from realizing the truth :-
"There Is No Box". [JavaScript Gadgets'n'Gizmos][JavaScript-FX]
RoyW is offline   Reply With Quote
Old 12-07-2006, 10:14 PM   PM User | #12
abyse
New to the CF scene

 
Join Date: Dec 2006
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
abyse is an unknown quantity at this point
many thaks 2 you man ! I will contact the allwebco-templates 4 the new updated version
__________________
http://www.fileden.com/files/2674/abyse.gif
Feel The Power
abyse is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:14 PM.


Advertisement
Log in to turn off these ads.