📄 calendar.js
字号:
var frameName = $puid();
function DatePattern(pattern){
for(var i=1,c=pattern.charAt(0) ;i<pattern.length;i++){
}
}
DatePattern.prototype.parseDate = function(pattern,date){
}
DatePattern.prototype.formatDate = function(pattern,date){
}
function initialize(){
var today = new Date();
var div = document.createElement("div");
div.style.position="static";
div.style.border="2px";
document.body.appendChild(div);
var frame = document.createElement("iframe");
frame.name = frameName;
frame.border = "0";
frame.frameBorder = "0";
frame.scrolling = 'no';
frame.id = frameName;
div.appendChild(frame);
var calendarWindow = frame.contentWindow;
if(!calendarWindow){
calendarWindow = document.frames[frameName];
}
//frame.src = $package.scriptBase + "calendar.html";
var html = $JSPackager.loadText($package.scriptBase + "calendar.html");
html = html.replace('<script src="../../../startup.js"></'+'script>','<base href="'+window.location.href+'" ><script src="'+$JSPackager.scriptRoot+$JSPackager.startupScript+'"><'+'/script>');
with(calendarWindow){
document.open();
//document.write("<html><body>xxxx</body></html>");
alert("html:"+html);
document.write(html);
document.close();
alert("outerHTML:"+document.body)
}
alert("xx:"+document.body)
}
function hide(){
$(frameName).style.display='none';
}
function show(){
$(frameName).style.display='block';
}
function setDate() {
var date = calendar.getSelectedDates()[0];
calendar.hide();
calendar.input.value = date;
calendar.input = null;
}
function selectDate(e){
if(initialize){
initialize();
initialize = null;
}
if(e == null){
e = window.event.srcElement;
}else{
if(e.srcElement){
e = e.srcElement;
}else{
e = $(e);
}
}
if(e){
var tagName = e.tagName.toLowerCase();
if(tagName == 'button' || (tagName == 'input' && (e.type == 'submit' || e.type == 'button'))){
e = e.previousSibling;
}
while(e){
tagName = e.tagName.toLowerCase();
if(tagName == 'input'){
break;
}else{
e = e.previousSibling;
}
}
}
if(!e){
$log.error("no element found");
return;
}
var frame = $(frameName);
frame.parentNode.style.display = "block";
var calendarWindow = frame.contentWindow;
if(!calendarWindow){
calendarWindow = document.frames[frameName];
}
var pos = YAHOO.util.Dom.getXY(e);
pos = [pos[0],pos[1]+e.offsetHeight+1];
calendarWindow.input = e;
//calendar.show();
//calendarWindow.input = e;
YAHOO.util.Dom.setXY(frame.parentNode, pos);
}
var openCalendar = selectDate;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -