Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Im changing textbox border color using javascript in onclick event of textbox. But how to change if tab is pressed..
Posted
Comments
StianSandberg 26-Jul-12 3:27am    
add an onclick event to your tab doing the same thing as the onclick event of your textbox....
Priyaaammu 26-Jul-12 3:31am    
Already did that...this is my javascript code
function FirstColor() {
document.getElementById("txtFirst").style.borderColor = "#3BB9FF";
}

This is my aspx code:
<asp:TextBox ID="txtFirst" runat="server" TabIndex="1" SkinID="First_Last_TextBox"
MaxLength="20" OnTextChanged="txtFirst_TextChanged" meta:resourcekey="txtFirstResource1" onclick="FirstColor()">

When clicking on textbox,i got the given color,but when using tab,the color didnt change
nguwar 26-Jul-12 4:10am    
you should try to use onFocus event instead of onClick event. here is the link, http://forums.asp.net/t/1751171.aspx/1
StianSandberg 28-Jul-12 9:24am    
Are you talking about the keyboard-tab or a tab like in a tab-control?

1 solution

if you are using tabcontainer control of ajax toolkit controls ,it has classes for hover,pressed and other cases for css ...
check this:
HTML
Tabs Css classes 
.ajax__tab_header: A container element that wraps all of the tabs at the top of the TabContainer. Child CSS classes:.ajax__tab_outer.
 .ajax__tab_outer: An outer element of a tab, often used to set the left-side background image of the tab.Child CSS classes: .ajax__tab_inner. 
.ajax__tab_inner: An inner element of a tab, often used to set the right-side image of the tab. Child CSS classes:.ajax__tab_tab.
 .ajax__tab_tab: An element of the tab that contains the text content. Child CSS classes:none.
.ajax__tab_body: A container element that wraps the area where a TabPanel is displayed. Child CSS classes: none.
.ajax__tab_hover . This is applied to a tab when the mouse is hovering over. Child CSS classes:.ajax__tab_outer. 
.ajax__tab_active: This is applied to a tab when it is the currently selected tab. Child CSS classes:.ajax__tab_outer. 



otherwise you can do this ...
for example your tab ID is "TabExample"
in you css file enter this :
HTML
#TabExample:activated


and this is for hover case:
HTML
#TabExample:hover


hope this solve your problem !
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900