Asp.net How to focus in div tag in javascript

I have created a tabs using div tag in javascript. I have asp.net button on each tab. whenever I clicked on button the focus is set to first tab.
I am using following code in page load event.
HtmlGenericControl content_1 = new HtmlGenericControl("content_1");
HtmlGenericControl content_2 = new HtmlGenericControl("content_2");
HtmlGenericControl content_3 = new HtmlGenericControl("content_3");
HtmlGenericControl content_4 = new HtmlGenericControl("content_4");
HtmlGenericControl content_5 = new HtmlGenericControl("content_5");
HtmlGenericControl selectedPage = new HtmlGenericControl(pageName);
content_1.Style["display"] = "none";
content_2.Style["display"] = "none";
content_3.Style["display"] = "none";
content_4.Style["display"] = "none";
content_5.Style["display"] = "none";

selectedPage.Style["display"] = "block";
selectedPage.Attributes.CssStyle.Add("class", "active");
 
Answer is:
 
each div will have unique id.
on clicking div tab, you will get the id of the div.
Using css style add class active to that div.
Add inactive class to other divs.
When you click another div , remove active class from this and add class to cliked one
 

0 comments: