【发布时间】:2011-10-06 23:23:50
【问题描述】:
我有以下工作日 jQuery UI 选项卡,我想在当前工作日打开:
<div id="tabs">
<ul>
<li><a href="monday.php">Monday</a></li>
<li><a href="tuesday.php">Tuesday</a></li>
<li><a href="wednesday.php">Wednesday</a></li>
<li><a href="thursday.php">Thursday</a></li>
<li><a href="friday.php">Friday</a></li>
<li><a href="saturday.php">Saturday</a></li>
<li><a href="sunday.php">Sunday</a></li>
</ul>
<script type="text/javascript">
$(function() {
$( "#tabs" ).tabs({
ajaxOptions: {
error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html(
"Couldn't load this tab. We'll try to fix this as soon as possible. " +
"If this wouldn't be a demo." );
}
}
});
});
</script>
我希望标签在一周中的当前一天打开,我知道这样可以:
.eq((new Date().getDay() || 7) - 1).click();
但无法使其正常工作,希望能得到一些帮助。另外,我希望当天的标签显示“今天”而不是工作日。
我将不胜感激。
谢谢,
布兰登
【问题讨论】: