有没有什么办法把视图日历改变显示方式,让它在web下更漂亮

wolflice 2004-08-11 05:03:59
有没有什么办法?
...全文
251 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
xn_nona 2004-09-02
  • 打赏
  • 举报
回复
楼上的,厉害阿!!佩服!
webdj 2004-09-02
  • 打赏
  • 举报
回复

<html>
<style type="text/css">
.body,td{
font-family:"Arial";
font-size:9pt;
color:#000000;
}
.TrOut{
background:#dddddd;
height:26;
border:1 solid #999999;
border-top-color:#f4f4f4;
border-left-color:#f4f4f4;
}
.TdOver{
background:#eeeeee;
height:20;
border:1 solid #ffffff;
border-top-color:#9c9c9c;
border-left-color:#9c9c9c;
color:red;
}
.TdOut{
background:#eeeeee;
height:20;
border:1 solid #9c9c9c;
border-top-color:#ffffff;
border-left-color:#ffffff;
}
</style>
<body>
<script>
var SelectDateObj;
function showdate(){
SelectDateObj=event.srcElement.previousSibling;
while(SelectDateObj.type!="text"){
SelectDateObj=SelectDateObj.previousSibling;
}
if(document.all.SelectDateList.style.display=='block')
document.all.SelectDateList.style.display='none';
else{
TableFunction().JumpToRun("start");
posX = event.clientX ;
posY = event.clientY ;
document.all.SelectDateList.style.left = parseInt(posX)-10 ;
document.all.SelectDateList.style.top = parseInt(posY);
document.all.SelectDateList.style.display='block';
}
}
function TableFunction(){
this.GetDateStr=function(y,m){
this.DayArray=[];
for(var i=0;i<42;i++)this.DayArray[i]=" ";
for(var i=0;i<new Date(y,m,0).getDate();i++)this.DayArray[i+new Date(y,m-1,1).getDay()]=i+1;
return this.DayArray;
}
this.GetTableStr=function(y,m){
this.DateArray=["日","一","二","三","四","五","六"];
this.DStr="<div id=SelectDateList name=SelectDateList style='display:none;position:absolute;'>"
this.DStr=this.DStr+"<table oncontextmenu='return false' onselectstart='return false' style='width:160;cursor:default;border:1 solid #9c9c9c;border-right:0;border-bottom:0;filter:progid:dximagetransform.microsoft.dropshadow(color=#e3e3e3,offx=3,offy=3,positive=true)' border='0' cellpadding='0' cellspacing='0'>\n"+
"<tr><td colspan='7' class='TrOut'>"+
"<table width='100%' height='100%'border='0' cellpadding='0' cellspacing='0'><tr align='center'>\n"+
"<td width='20' style='font-family:\"webdings\";font-size:9pt' onclick='TableFunction().JumpToRun(\"b\")' onmouseover='this.style.color=\"#ff9900\"' onmouseout='this.style.color=\"\"'>3</td>\n"+
"<td id='YearTD' width='70' onmouseover='this.style.background=\"#cccccc\"' onmouseout='this.style.background=\"\"' onclick='TableFunction().WriteSelect(this,this.innerText.split(\" \")[0],\"y\",false)'>"+y+" 年</td>\n"+
"<td id='MonthTD' width='47' onmouseover='this.style.background=\"#cccccc\"' onmouseout='this.style.background=\"\"' onclick='TableFunction().WriteSelect(this,this.innerText.split(\" \")[0],\"m\",false)'>"+m+" 月</td>\n"+
"<td width='20' style='font-family:\"webdings\";font-size:9pt' onclick='TableFunction().JumpToRun(\"n\")' onmouseover='this.style.color=\"#ff9900\"' onmouseout='this.style.color=\"\"'>4</td></tr></table>\n"+
"</td></tr>\n"+
"<tr align='center'>\n";
for(var i=0;i<7;i++)
this.DStr+="<td class='TrOut'>"+DateArray[i]+"</td>\n";
this.DStr+="</tr>\n";
for(var i=0;i<6;i++){
this.DStr+="<tr align='center'>\n";
for(var j=0;j<7;j++){
var CS=new Date().getDate()==this.GetDateStr(y,m)[i*7+j]?"TdOver":"TdOut";
this.DStr+="<td id='TD' class='"+CS+"' cs='"+CS+"' onmouseover='this.className=\"TdOver\"' onmouseout='if(this.cs!=\"TdOver\")this.className=\"TdOut\"' onclick='TableFunction().AlertDay()'>"+this.GetDateStr(y,m)[i*7+j]+" </td>\n";
}
this.DStr+="</tr>\n";
}
this.DStr+="</table></div>";
return this.DStr;
}
this.WriteSelect=function(obj,values,action,getobj){
if(values=="")return;
if(getobj){
obj.innerHTML=values+(action=="y"?" 年":" 月");
this.RewriteTableStr(YearTD.innerText.split(" ")[0],MonthTD.innerText.split(" ")[0]);
return false;
}
var StrArray=[];
if(action=="y"){
for(var i=0;i<15;i++){
var year=values-7+i;
StrArray[i]="<option value='"+year+"' "+(values==year?"selected":"")+"> "+year+"年</option>\n";
}
obj.innerHTML="<select id='select1' style='width:67' onchange='TableFunction().WriteSelect(parentElement,this.value,\"y\",true)' onblur='YearTD.innerText=this.value+\" 年\"'>\n"+StrArray.join("")+"</select>";
select1.focus();
}
if(action=="m"){
for(var i=1;i<13;i++)
StrArray[i]="<option value='"+i+"' "+(i==values?"selected":"")+"> "+i+"月</option>\n";
obj.innerHTML="<select id='select2' style='width:47' onchange='TableFunction().WriteSelect(parentElement,this.value,\"m\",true)' onblur='MonthTD.innerText=this.value+\" 月\"'>\n"+StrArray.join("")+"</select>";
select2.focus();
}
}
this.RewriteTableStr=function(y,m){
var TArray=this.GetDateStr(y,m);
var len=TArray.length;
for(var i=0;i<len;i++){
TD[i].innerHTML=TArray[i]+" ";
TD[i].className="TdOut";
TD[i].cs="TdOut";
if(new Date().getYear()==y&&new Date().getMonth()+1==m&&new Date().getDate()==TArray[i]){
TD[i].className="TdOver";
TD[i].cs="TdOver";
}
}
}
this.JumpToRun=function(action){
var YearNO=YearTD.innerText.split(' ')[0];
var MonthNO=MonthTD.innerText.split(' ')[0];
if(action=="b"){
if(MonthNO=="1"){
MonthNO=13;
YearNO=YearNO-1;
}
MonthTD.innerText=MonthNO-1+" 月";
YearTD.innerText=YearNO+" 年";
this.RewriteTableStr(YearNO,MonthNO-1);
}
if(action=="n"){
if(MonthNO=="12"){
MonthNO=0;
YearNO=YearNO-(-1);
}
YearTD.innerText=YearNO+" 年";
MonthTD.innerText=MonthNO-(-1)+" 月";
this.RewriteTableStr(YearNO,MonthNO-(-1));
}
if(action=="start"){
MonthNO=new Date().getMonth();
YearNO=new Date().getYear();
YearTD.innerText=YearNO+" 年";
MonthTD.innerText=MonthNO-(-1)+" 月";
this.RewriteTableStr(YearNO,MonthNO-(-1));
}
}
this.AlertDay=function(){
if(event.srcElement.innerText!=" ")
// alert(YearTD.innerText.split(' ')[0]+"年"+MonthTD.innerText.split(' ')[0]+"月"+event.srcElement.innerText+"日");
SelectDateObj.value=YearTD.innerText.split(' ')[0]+"-"+MonthTD.innerText.split(' ')[0]+"-"+event.srcElement.innerText
SelectDateObj.disabled=true;
document.all.SelectDateList.style.display="none";
}
return this;
}
document.write(TableFunction().GetTableStr(new Date().getYear(),new Date().getMonth()+1));
</script>
<input type=text name=date disabled><input type=button value="选择日期" onclick="showdate();">
<br><br><br><br><br><br><br>
<input type=text name=date2 disabled>中间有字间隔<input type=button value="选择日期" onclick="showdate();">
</body></html>
亓锋 2004-08-20
  • 打赏
  • 举报
回复
上www.notes.net上的sandbox里有人做过一个例子的。
1234qwer 2004-08-19
  • 打赏
  • 举报
回复
干吗费劲做呢
CrazyDeng 2004-08-13
  • 打赏
  • 举报
回复
日历使用梅花雨
Intotherain1 2004-08-13
  • 打赏
  • 举报
回复
是很麻烦哦。解决的办法就是把视图的html打出来
然后写出你要显示出来视图的html代码
分析原html的特征 使用js 的replace去转化

我只做过普通视图的 但日历视图显然更难 没办法 没人乐于公布这个 毕竟是个体力活 很麻烦 很需要耐心
haoduoren123456789 2004-08-13
  • 打赏
  • 举报
回复
用CSS去解决,设置td这个表格中的基础元素.
cb0211 2004-08-12
  • 打赏
  • 举报
回复
给你个建议 在表单的onload上写JS代码 主要是替换已有的HTML代码 则可达到修改样式目的
wolflice 2004-08-12
  • 打赏
  • 举报
回复
能不能自定义日历视图的格式
wolflice 2004-08-12
  • 打赏
  • 举报
回复
想lotus的日历格式是自带的,我们如何给它做样式定义呢?并且它出现日历的table border=1 ,很难看,这个也没有办法定义,
chenfei00 2004-08-12
  • 打赏
  • 举报
回复
我出80分,有谁有办法解决啊?
gjd111686 2004-08-11
  • 打赏
  • 举报
回复
用CSS和JS自己做一下,耐心点就好看了.

535

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧