Y
Yves Lange
Hello i wrote a little script in JavaScript which makes my menu dynamic.
The menu can move with the window while the user moves up or down. But
the problem is that when a user click on a link (of this menu) i want
that the background of the cell stay in a specific color which will be
useful for the user to know which page he is reading. How can i do that ?
Thanks
---------------------------------------------------------
<script>
target5 = '_self';
haut5 = 10;
largeur5 = 10
color50 = "#333333";
color51 = "#555555";
color52 = "#838383";
color53 = "#FFFFFF";
menu5titre = new Array;
menu5lien = new Array;
menu5titre[0]= '-home'
menu5lien[0]= 'index.php'
menu5titre[1] = '-info coaching';
menu5lien[1] = 'index.php?p=info';
menu5titre[2] = '-contrat individuel';
menu5lien[2] = 'index.php?p=contrat-individuel';
menu5titre[3] = '-curriculum vitae';
menu5lien[3] = 'index.php?p=cv';
menu5titre[4] = '-contact';
menu5lien[4] = 'index.php?p=contact';
document.write('<STYLE TYPE="text/css">#menu5 {
position:absolute;top:'+haut5+';left:'+gauche5+'; }</STYLE>');
ie4=document.all
ns6=document.getElementById&&!document.all
ns4=document.layers
function placeMenu5() {
if (ie4) {menu5.style.pixelTop=document.body.scrollTop+haut5}
else if (ns6)
{document.getElementById("menu5").style.top=window.pageYOffset+haut5}
else if (ns4)
{eval(document.menu5.top=eval(window.pageYOffset+haut5));}
if(ie4 || ns6 || ns4)
setTimeout("placeMenu5()",1);
}
window.onload = placeMenu5;
document.write('<SPAN ID=menu5><table bgcolor="'+color50+'"
border=0 cellspacing=1 cellpadding=0 WIDTH=150><tr
/////////////////////////////
Here is the cell that i want
colored while reading a document.
I mean, only the specific line
////////////////////////////
for(a=0;a<menu5lien.length;a++)
{
document.write('<TR bgcolor='+color51+'><TD
onMouseOut="this.style.background=\''+color51+'\'"
onMouseOver="this.style.background=\''+color52+'\'"
STYLE="cursorointer"
onClick="window.open(\''+menu5lien[a]+'\',\''+target5+'\')"><FONT
FACE="Verdana, Arial" SIZE=1><B><A HREF="'+menu5lien[a]+'"
TARGET="'+target5+'"
STYLE="text-decoration:none;color:'+color53+'">'+menu5titre[a]+'</A></B></FONT></TD></TR>');
}
document.write('</TR></TABLE></SPAN>')
</script>
The menu can move with the window while the user moves up or down. But
the problem is that when a user click on a link (of this menu) i want
that the background of the cell stay in a specific color which will be
useful for the user to know which page he is reading. How can i do that ?
Thanks
---------------------------------------------------------
<script>
target5 = '_self';
haut5 = 10;
largeur5 = 10
color50 = "#333333";
color51 = "#555555";
color52 = "#838383";
color53 = "#FFFFFF";
menu5titre = new Array;
menu5lien = new Array;
menu5titre[0]= '-home'
menu5lien[0]= 'index.php'
menu5titre[1] = '-info coaching';
menu5lien[1] = 'index.php?p=info';
menu5titre[2] = '-contrat individuel';
menu5lien[2] = 'index.php?p=contrat-individuel';
menu5titre[3] = '-curriculum vitae';
menu5lien[3] = 'index.php?p=cv';
menu5titre[4] = '-contact';
menu5lien[4] = 'index.php?p=contact';
document.write('<STYLE TYPE="text/css">#menu5 {
position:absolute;top:'+haut5+';left:'+gauche5+'; }</STYLE>');
ie4=document.all
ns6=document.getElementById&&!document.all
ns4=document.layers
function placeMenu5() {
if (ie4) {menu5.style.pixelTop=document.body.scrollTop+haut5}
else if (ns6)
{document.getElementById("menu5").style.top=window.pageYOffset+haut5}
else if (ns4)
{eval(document.menu5.top=eval(window.pageYOffset+haut5));}
if(ie4 || ns6 || ns4)
setTimeout("placeMenu5()",1);
}
window.onload = placeMenu5;
document.write('<SPAN ID=menu5><table bgcolor="'+color50+'"
border=0 cellspacing=1 cellpadding=0 WIDTH=150><tr
/////////////////////////////
Here is the cell that i want
colored while reading a document.
I mean, only the specific line
////////////////////////////
ALIGN=center><B>Menu</B></TD></TR>')> <TD
for(a=0;a<menu5lien.length;a++)
{
document.write('<TR bgcolor='+color51+'><TD
onMouseOut="this.style.background=\''+color51+'\'"
onMouseOver="this.style.background=\''+color52+'\'"
STYLE="cursorointer"
onClick="window.open(\''+menu5lien[a]+'\',\''+target5+'\')"><FONT
FACE="Verdana, Arial" SIZE=1><B><A HREF="'+menu5lien[a]+'"
TARGET="'+target5+'"
STYLE="text-decoration:none;color:'+color53+'">'+menu5titre[a]+'</A></B></FONT></TD></TR>');
}
document.write('</TR></TABLE></SPAN>')
</script>