Javascript


#1

Hi.
In my App i have Tabs like below

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

Manage Accounts
Roles
onclick= “tp_select();”>Users
onclick= “tp_select();”>Contact Us

[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 all the tab.
Pls help me on this.
Pls advice.


#2

maybe like so?

Manage Accounts
Roles
Users
Contact Us

function tp_select(a) {
// clear out the others
$$(’.tab_link’).each(function(el){
el.removeClassName(‘tp_select’)
})
// add back in for this one
$(a.id).addClassName(‘tp_select’)
}

On Nov 11, 3:59 am, Newb N. removed_email_address@domain.invalid