View Full Version : frames, links and colours
Hi.
I have a frameset with two frames.
In the topframe I have a menu (menu.html) with a CSS defining the link colours.
Is it possible that when I have clicked a link in the menu, the link colour stays "active" until clicking another link in the menu. Then the link colour of the first link turns to "visited" and the next link turns to "active"?
(How did that happen???)
Anyway, here's what I got:
<!-- frames.html -->
<FRAMESET ROWS="80,*">
<FRAME SRC="menu.html" NAME="menu" ID="menu" FRAMEBORDER="0" SCROLLING="No" MARGINWIDTH="1"
MARGINHEIGHT="1">
<FRAME SRC="page1.html" NAME="main" ID="main" SCROLLING="Auto" MARGINWIDTH="1" MARGINHEIGHT="1">
</FRAMESET>
<!-- menu.html -->
<STYLE TYPE="text/css">
a:link {
text-decoration: none;
color: #000000;
font-weight:bold
}
a:active {
text-decoration: none;
color: #DC143C;
font-weight:bold
}
a:visited {
text-decoration: none;
color: #FFD700;
font-weight:bold
}
a:hover {
text-decoration: none;
color: #FF0000;
font-weight:bold
}
</STYLE>
</head>
<BODY>
<TABLE WIDTH="300" BORDER="1" CELLSPACING="0" CELLPADDING="0" ALIGN="center" BGCOLOR="#446688">
<TR>
<TD WIDTH="100" BGCOLOR="#446688"><A href="side1.html" target="main">1</A></TD>
<TD WIDTH="100" BGCOLOR="#446688"><A href="side2.html" target="main">2</A></TD>
<TD WIDTH="100" BGCOLOR="#446688"><A href="side3.html" target="main">3</A></TD>
</TR>
</TABLE>
Thanks!
Ole
adios
10-16-2002, 07:18 PM
Someone'll post a simple answer here and make me feel like an idiot - but, anyway, pretty sure you need a combination of JS & CSS for this.
<script type="text/javascript">
var latchColor = '#33ff33'
function latchit(link) {
var l, i =0;
while (l = document.links[i++])
if (l != link) {
l.style.color = '';
l.latched = false;
} else {
l.style.color = latchColor;
l.latched = true;
}
}
HTML:
<A href="blah.htm" target="main"
onmouseover="this.style.color='#ff0000'"
onmouseout="if(!this.latched)this.style.color='';else this.style.color=latchColor"
onclick="latchit(this)">1</A>
Might fly...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.