Girard Ibanez
05-19-2007, 02:25 PM
First I would like to Thank the Dynamic Forums and its dedicated members.
Here's the problem:
I have a js script that will highlight (style) the current page on the navigation links.
The nav is styled so that the:
a:visited, a:link are the same colors.
a:hover is color x
a:active is color y
The js script will style the current nav hyper link but the color is over ridden by the a:visited. The objective is to keep all the hyper links the SAME color except for the a:hover and current link.
Here's the link:
Click on links under Mechanical Setups and note that the nav color will be gray & larger. The current nav should have a different color but does not.
http://www.ibanezfromguam.net/myraptor/r50v2/r50v2_homepage.html
JS script
// JavaScript Document
function hlightpagelink(){
var url=location.href
if(url.indexOf('r50v2/r50v2_aileron_linkage.htm')>-1)
document.getElementById('r50v2_aileron_linkage_link').className='onthispage'
if(url.indexOf('r50v2/r50v2_elevator_linkage.htm')>-1)
document.getElementById('r50v2_elevator_linkage_link').className='onthispage'
if(url.indexOf('r50v2/r50v2_collective_linkage.htm')>-1)
document.getElementById('r50v2_collective_linkage_link').className='onthispage'
if(url.indexOf('r50v2/r50v2_throttle_linkage.htm')>-1)
document.getElementById('r50v2_throttle_linkage_link').className='onthispage'
if(url.indexOf('r50v2/r50v2_rudder_linkage.htm')>-1)
document.getElementById('r50v2_rudder_linkage_link').className='onthispage'
}
if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", hlightpagelink, false );
else if ( typeof window.attachEvent != "undefined" )
window.attachEvent( "onload", hlightpagelink );
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
hlightpagelink();
};
}
else
window.onload = hlightpagelink;
}
CSS
.leftnav a:visited {
text-decoration: none;
color: #797979;
}
.leftnav a:link {
text-decoration: none;
color: #797979;
}
.leftnav a:hover {
color: #c02020;
text-decoration: underline;
}
.leftnav a:active {
font-weight: bold;
color: #797979;
text-decoration: underline;
}
.onthispage {
font-weight: bold;
text-decoration: underline;
font-size: 1.2em;
color: #008000;
}
HTML
[HTML]
[/ <h6 class="color_b">Mechanical Setups </h6>
<ul class="leftnav align_c">
<li><a href="../r50v2/r50v2_aileron_linkage.html" id="r50v2_aileron_linkage_link">Aileron Linkage </a></li>
<li><a href="../r50v2/r50v2_elevator_linkage.html" id="r50v2_elevator_linkage_link">Elevator Linkage </a></li>
<li><a href="../r50v2/r50v2_collective_linkage.html" id="r50v2_collective_linkage_link">Collective Linkage </a></li>
<li><a href="../r50v2/r50v2_throttle_linkage.html" id="r50v2_throttle_linkage_link">Rudder Linkage </a></li>
<li><a href="../r50v2/r50v2_rudder_linkage.html" id="r50v2_rudder_linkage_link">Rudder Linkage </a></li>
</ul>HTML]
Here's the problem:
I have a js script that will highlight (style) the current page on the navigation links.
The nav is styled so that the:
a:visited, a:link are the same colors.
a:hover is color x
a:active is color y
The js script will style the current nav hyper link but the color is over ridden by the a:visited. The objective is to keep all the hyper links the SAME color except for the a:hover and current link.
Here's the link:
Click on links under Mechanical Setups and note that the nav color will be gray & larger. The current nav should have a different color but does not.
http://www.ibanezfromguam.net/myraptor/r50v2/r50v2_homepage.html
JS script
// JavaScript Document
function hlightpagelink(){
var url=location.href
if(url.indexOf('r50v2/r50v2_aileron_linkage.htm')>-1)
document.getElementById('r50v2_aileron_linkage_link').className='onthispage'
if(url.indexOf('r50v2/r50v2_elevator_linkage.htm')>-1)
document.getElementById('r50v2_elevator_linkage_link').className='onthispage'
if(url.indexOf('r50v2/r50v2_collective_linkage.htm')>-1)
document.getElementById('r50v2_collective_linkage_link').className='onthispage'
if(url.indexOf('r50v2/r50v2_throttle_linkage.htm')>-1)
document.getElementById('r50v2_throttle_linkage_link').className='onthispage'
if(url.indexOf('r50v2/r50v2_rudder_linkage.htm')>-1)
document.getElementById('r50v2_rudder_linkage_link').className='onthispage'
}
if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", hlightpagelink, false );
else if ( typeof window.attachEvent != "undefined" )
window.attachEvent( "onload", hlightpagelink );
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
hlightpagelink();
};
}
else
window.onload = hlightpagelink;
}
CSS
.leftnav a:visited {
text-decoration: none;
color: #797979;
}
.leftnav a:link {
text-decoration: none;
color: #797979;
}
.leftnav a:hover {
color: #c02020;
text-decoration: underline;
}
.leftnav a:active {
font-weight: bold;
color: #797979;
text-decoration: underline;
}
.onthispage {
font-weight: bold;
text-decoration: underline;
font-size: 1.2em;
color: #008000;
}
HTML
[HTML]
[/ <h6 class="color_b">Mechanical Setups </h6>
<ul class="leftnav align_c">
<li><a href="../r50v2/r50v2_aileron_linkage.html" id="r50v2_aileron_linkage_link">Aileron Linkage </a></li>
<li><a href="../r50v2/r50v2_elevator_linkage.html" id="r50v2_elevator_linkage_link">Elevator Linkage </a></li>
<li><a href="../r50v2/r50v2_collective_linkage.html" id="r50v2_collective_linkage_link">Collective Linkage </a></li>
<li><a href="../r50v2/r50v2_throttle_linkage.html" id="r50v2_throttle_linkage_link">Rudder Linkage </a></li>
<li><a href="../r50v2/r50v2_rudder_linkage.html" id="r50v2_rudder_linkage_link">Rudder Linkage </a></li>
</ul>HTML]