Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling link style 2

Status
Not open for further replies.

arunrr

Programmer
Oct 2, 2009
103
US
Firstly, i have the following style specified...

<style type="text/css">
a:link {COLOR: #0000FF;}
a:visited {COLOR: #0000FF;}
a:hover {COLOR: #D40606;}
a:active {COLOR: #0000FF;}
</style>

This behavior works when my <a> tag is something like...
<a href="/WC/schedule_a1.html" target="showcal">Group A1</a>

I would like a similar behavior when I change the <a> tag content to...
<a ONCLICK="document.getElementById('HTMLfile').innerHTML='<iframe width=100% height=320 marginwidth=0 marginheight=0 frameborder=0 src=/WC/schedule_a1.html></iframe>';">Group A1</a>

I tried <style type="text/javascript"> - didn't work

Thanks,
Arun
 
Hi

You are defining the color for [tt]a:link[/tt], so that will affect only [tt]a[/tt] tags which are functionally links. ( To exclude the old style [tt]a name="#"[/tt] usage. ) If you want all [tt]a[/tt] elements to wear that style, then remove the [tt]:link[/tt] part.

By the way, this has absolutely nothing to do with JavaScript.


Feherke.
 
You could also make it a functional link, but add a return false; to your JS code so the link does not actually operate, but still follows the link stylings.

Code:
<a [red]href="#"[/red] ONCLICK="document.getElementById('HTMLfile').innerHTML='<iframe width=100% height=320 marginwidth=0 marginheight=0 frameborder=0 src=/WC/schedule_a1.html></iframe>'; [red] return false;[/red]">Group A1</a>

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Thanks.

Got the hover to work with...

onMouseOver="this.style.color='#D40606'"
onMouseOut="this.style.color='blue'"

within the <a> tag.

Sorry about use of wrong forum. Point noted...
Arun
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top