大家应该都知道jscalendar这个日期选择框吧。 当在yui-ext中的dialog使用时,大家应该会想到会发生什么吧。日期选择框在变灰的背景后面。如下图:
[img]http://dengyin2000.iteye.com/upload/picture/pic/2824/7986f445-2b74-4884-bff1-aeec952af774.jpg[/img]
大家都应该知道引起这个问题的原因是dialog的z-index比日期选择框的大。ok。我们只要让日期选择框的z-index比dialog还要大就ok。。
修改 calendar.js代码。 让在创建日期选择框的div时加上z-index属性.
[code]Calendar.prototype.create = function (_par) {
var parent = null;
if (! _par) {
// default parent is the document body, in which case we create
// a popup calendar.
parent = document.getElementsByTagName("body")[0];
this.isPopup = true;
} else {
parent = _par;
this.isPopup = false;
}
this.date = this.dateStr ? new Date(this.dateStr) : new Date();
var table = Calendar.createElement("table");
this.table = table;
table.cellSpacing = 0;
table.cellPadding = 0;
table.calendar = this;
Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown);
var div = Calendar.createElement("div");
this.element = div;
div.className = "calendar";
if (this.isPopup) {
div.style.position = "absolute";
div.style.display = "none";
[b]div.style.zIndex = "11111";[/b]
}
div.appendChild(table);
[/code]
粗体是后面加上的。
改后的效果ok。
[img]http://dengyin2000.iteye.com/upload/picture/pic/2825/2e709b78-2fd4-4351-b2aa-678b2ea944c5.jpg[/img]
[img]http://dengyin2000.iteye.com/upload/picture/pic/2824/7986f445-2b74-4884-bff1-aeec952af774.jpg[/img]
大家都应该知道引起这个问题的原因是dialog的z-index比日期选择框的大。ok。我们只要让日期选择框的z-index比dialog还要大就ok。。
修改 calendar.js代码。 让在创建日期选择框的div时加上z-index属性.
[code]Calendar.prototype.create = function (_par) {
var parent = null;
if (! _par) {
// default parent is the document body, in which case we create
// a popup calendar.
parent = document.getElementsByTagName("body")[0];
this.isPopup = true;
} else {
parent = _par;
this.isPopup = false;
}
this.date = this.dateStr ? new Date(this.dateStr) : new Date();
var table = Calendar.createElement("table");
this.table = table;
table.cellSpacing = 0;
table.cellPadding = 0;
table.calendar = this;
Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown);
var div = Calendar.createElement("div");
this.element = div;
div.className = "calendar";
if (this.isPopup) {
div.style.position = "absolute";
div.style.display = "none";
[b]div.style.zIndex = "11111";[/b]
}
div.appendChild(table);
[/code]
粗体是后面加上的。
改后的效果ok。
[img]http://dengyin2000.iteye.com/upload/picture/pic/2825/2e709b78-2fd4-4351-b2aa-678b2ea944c5.jpg[/img]