开发者

Class changed by javascript not recognised in VB click event

On my page I have two tabbed sections of content. When the page is first loaded, the first tabbed area is displayed and the other one is hidden. I have some javascript in place which switches tabs and hides/displays the relevant content when one of the tabs are clicked. To mark which tab is the active tab, the active tab is given the class of "current".

When I submit a button on that page, I want it to do one of two things depending on which tabbed area 开发者_如何转开发is displayed. To find out which tab has been clicked, I check the class attribute of each tab:

Select Case True
   Case tab1.Attributes("class").Contains("current")
   ....
   Case tab2.Attributes("class").Contains("current")
   ....
End Select

However, checking the class attribute in this way shows that even though tab2 has been selected, tab1 always has the "current" class.

If however I create a hidden input like this:

<input type="hidden" id="SelectedTab" runat="server" class="SelectedTab" />

and then whilst changing tabs in my javascript, also set the name of the selected tab to display in the value of the hidden input, the correct tab name is recognised from the click event in my VB code.

Could someone please explain why this is?


Instead of using the hidden field, use the asp.net hidden field control and try again the same what you are doing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜