"WindAndWaves" <ac****@ngaru.com> wrote in message
news:6W*******************@news.xtra.co.nz...
Hi Gurus and Folk
I have the following line of code:
<A HREF="#fac" CLASS="m" ONCLICK="showD('bas','fac');this.blur();return
false;">show information</A>
the showD function shows a div. People without Javascript are linked to
the #fac bookmark.
Now, I would really love to change the colour/size/position of the show
information text, to show the user they are currently looking at the #fac
section of the page, but as usual, have no idea where to start.
I could use :visited, but that would not be as effective (e.g. if they
choose another option then the #fac would still be visited).
TIA
- Nicolaas
I guess if I have alienated the entire www population, I just have to answer
my own questions....
Here is what I did:
function showD(b,el, m, a){
// b = the ID of the content DIV
// el = the div element
// m the ID of the menu DIV, and
// a the link within the menu that makes it happen (i.e. the one that should
be highlighted
var d = 'none'
if (el == 'all'){
d = ''
}
var bRef = null;
if (document.getElementById) {
bRef = document.getElementById(b);
} else {
bRef = document.all[b];
}
if(bRef.childNodes){
var z = bRef.childNodes;
for (var i=0;i<z.length; i++) {
if (z[i].nodeName =='DIV' && z[i].style) {
z[i].style.display = d;
if (z[i].id == el) z[i].style.display = '';
}
}
}//change the actual href
var mRef = null;
if (document.getElementById) {
mRef = document.getElementById(m)
} else {
mRef = document.all[m];
}
if(mRef.childNodes){
var z = mRef.childNodes;
for (var i=0;i<z.length; i++) {
if (z[i].nodeName =='A' && z[i].className) {
z[i].className = 'm';
if (z[i].id == a) z[i].className = 'ms';
}
}
return true;
}
}
The Onclick is now:
<A HREF="#fac" ONCLICK="return !showD('bas','fac', 'men', 'afac');">
any comments greatly appreciated.
- Nicolaas