Topic: HELP

hi Friends..
I m very new to javascript and CSS kind of things.
In my App i have Tabs like below

[Manage Contacts] [Roles] [users] [Contact Us]

<a href="#" id="d1" onclick= "tp_select();">Manage Accounts</a>
<a href="#" id="d2" onclick= "tp_select();">Roles</a>
<a href="#" id="d3">onclick= "tp_select();">Users</a>
<a href="#" id="d4">onclick= "tp_select();">Contact Us</a>

[On click Event]if user clicks on  Roles tab means the Style class "tp_select" has to be called for Roles tab.
and if user clicks on Contact Us tab means the Style class "tp_select" has to be called for Contact Us tab.
#-----i ve done java script function----#
function tp_select() {
    $('d1').addClassName('tp_select')
   
   
}

#--------------#
i don't know how to call this function for all the element.
it works for Manage Accounts tab.
i don't know how to write javascript function for this.
Pls help me on this.
Pls advice.

Last edited by newb (2008-11-11 05:00:24)

Re: HELP

Pls Some one Could help me

Re: HELP

I'm not exactly sure what you wish to do, but if you want to change the appearance of the selected tab, the best way to do so is to make a public/stylesheets/default.css file. In this file, you can place something like the following:
*****************************************
a
{
color: blue;
text-decoration: none;
font-weight: normal;
}
a:visited
{
color: green;
text-decoration: none;
font-weight: normal;
}
a:hover
{
color: red;
background-color:#000;
text-decoration: none;
font-weight: normal;
}
*****************************************
You will need to connect your file to the css file by adding
<%= stylesheet_link_tag 'default' %>
to the top of the file.

Hope that helps!