$("[id$='tab_TabContainer1_TabPanel2']").click(function (e) {
var container = $find('TabContainer1');
if (event.preventDefault) {
event.preventDefault(); //works for anything with preventDefault (e.g., not called from html onclick, etc.)
}
else {
event.returnValue = false; //supposed to be IE specific - on global event 'event'
}
$("[id$='Button1']").click(); //perform the button1 click event (which calls custom validation)
if (Page_IsValid) {
container.set_activeTabIndex(1); //go ahead to next tab
}
else {
container.set_activeTabIndex(0); //stay here on current tab
}
return false;
});
它应该是这么简单,上面的工作在firefox / google chrome,但不是IE8。 IE8只是在验证后转到下一个选项卡,无论如何。即使我回归虚假;马上,它只是进入下一个标签。亲爱的獾不在乎,亲爱的獾只是去了下一个标签。有什么想法吗?
答案 0 :(得分:0)
你的问题是使用“事件”而不是你实际上称之为事件的事件。将事件更改为e,如下所示,它应该工作正常! =]
$("[id$='tab_TabContainer1_TabPanel2']").click(function(e) {
var container = $find('TabContainer1');
e.preventDefault(); //works for anything with preventDefault (e.g., not called from html onclick, etc.)
$("[id$='Button1']").click(); //perform the button1 click event (which calls custom validation)
...