2011-08-31 81 views
0

我正在使用Ajax Toolkit日曆擴展器,並且我想在日曆彈出時加粗當前日期。Ajax Toolkit日曆擴展器當前日期爲ASP.NET

var a = "1"; 
var b = ""; 

function ShowToday(e) { 
    if (a == "1") { 
     a = $("td.ajax__calendar_active > div").attr('id'); 
     a = '#' + a; 
     b = a; 
     $(a).css('font-weight', 'bold'); 
    } 
    else { 
     $(b).css('font-weight', 'bold'); 
    } 
} 

function CurrentDateShowing(e) { 
    if (!e.get_selectedDate() || !e.get_element().value) { 
     e._selectedDate = (new Date()).getDateOnly(); 
    } 
} 

我uisng上OnClientShowing事件 「CurrentDateShowing」 功能,並在OnClientShown事件 「ShowToday」。

目前我正在使用這個javascript,但是這個腳本有一個問題,當我切換到另一個月時,當前日期的單元格的單元仍然是粗體。我怎樣才能克服這個問題。另一個問題,當我在頁面上有兩個日曆擴展器這不起作用。請幫忙。

回答

1

你可以修改你的css代碼來改變風格。
.ajax__calendar_active:這適用於DOM中某天,某月或某年以上的元素,並用於應用顯示當前選定值的CSS屬性。

.ajax__calendar_active 
{ 
     font-weight:bold; 
} 

日曆CSS類

* .ajax__calendar_container : The outer rectangular container that supplies the border around the calendar element. Child Css classes: .ajax__calendar_header,.ajax__calendar_body,.ajax__calendar_footer. 
* .ajax__calendar_header : A container element that holds the next and previous arrows and the title of the current view. Child Css classes: .ajax__calendar_prev, .ajax__calendar_title, .ajax__calendar_next. 
* .ajax__calendar_prev : An element that displays the arrow to view the previous set of data in the view(previous month/year/decade). Child Css classes: none. 
* .ajax__calendar_title : An element that displays the title of the current view (month name, year, decade). Child Css classes: none. 
* .ajax__calendar_next : An element that displays the arrow to view the previous set of data in the view (previous month/year/decade). Child Css classes: none. 
* .ajax__calendar_body : A container element that holds the days, months, and years panes. Also provides a fixed rectangle with hidden overflow that is used for transitioning between views (next/previous month, or days/months/years).Child Css class: .ajax__calendar_days, .ajax__calendar_months, .ajax__calendar_years. 
* .ajax__calendar_days : A container element that holds the layout for the days in a month. Child Css classes: .ajax__calendar_dayname, .ajax__calendar_day 
* .ajax__calendar_dayname : An element that displays the short name of the day of the week. Child Css classes: none. 
* .ajax__calendar_day : An element that displays the day of the month. Child Css classes: none 
* .ajax__calendar_months : A container element that holds the layout for the months in a year. Child Css classes: .ajax__calendar_month. 
* .ajax__calendar_month : An element that displays the month of the year. Child Css classes: none 
* .ajax__calendar_years : A container element that holds the layout for the years in a decade. Child Css classes: .ajax__calendar_year. 
* .ajax__calendar_year : An element that displays the year in a decade. Child Css classes: none 
* .ajax__calendar_footer : A container element that holds the current date. Child Css classes: .ajax__calendar_today. 
* .ajax__calendar_today : An element that displays the current date. Child Css classes: none. 
* .ajax__calendar_hover : This is applied to an element in the DOM above a day, month or year and is used to apply CSS attributes that show a hover state. Child Css classes: .ajax__calendar_day, .ajax__calendar_month, .ajax__calendar_year 
* .ajax__calendar_active : This is applied to an element in the DOM above a day, month or year and is used to apply CSS attributes that show the currently selected value. Child Css classes: .ajax__calendar_day, .ajax__calendar_month, .ajax__calendar_year. 
* .ajax__calendar_other : This is applied to an element in the DOM above a day or year that is outside of the current view (day not in the visible month, year not in the visible decade). Child Css classes: .ajax__calendar_day, .ajax__calendar_year. 
2

使用CSS樣式的 「今天」 的元素:可用的CSS類的

.ajax__calendar_today { font-weight: bold; } 

全部細節都在Samples Site