471,091 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,091 software developers and data experts.

changin the onclick link

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
Jul 23 '05 #1
1 1277

"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
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

17 posts views Thread by Mike Gratee | last post: by
1 post views Thread by Aftab Alam | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.