优内建站网,专业建站,企业建站,免费建站,智能建站,个人建站!
主营企业建站,seo优化,手机网站,微信网站开发等业务!>> 繁体中文
用户名: 密 码: 验证码:    
企业建站,专业建站,模板建站,智能建站
 您现在的位置:首页 >> Javascript教程 >> 详细内容>>        【字体:  】【颜色: 绿

JavaScript:变色日历

在百度搜索关于“JavaScript:变色日历”的内容

在谷歌搜索关于“JavaScript:变色日历”的内容

买空间、服务器就上威客主机网(VK163.COM) 虚拟主机评测+IDC导航=威客主机之家 标志设计
[内容提要] scriptlanguage="JScript"!--Begin //placethesescriptswithinBODYtagifyouareusingIE4.0orbelow.//*******************************************...

作者: 优内科技  来源: 优内科技  驻站日期:2008/12/30 【 加入收藏 】 【 打印此页 】 【 关闭

<script language="JScript">
<!-- Begin //place these scripts within BODY tag if you are using IE 4.0 or below.
//****************************************************************************
// Release date: 2000.5.9
// Anyone may modify it to satify his needs, but please leave this comment ahead.
//****************************************************************************
var gdCtrl = new Object();
var gcGray = "#808080";
var gcToggle = "#ffff00";
var gcBG = "#cccccc";
var gdCurDate = new Date();
var giYear = gdCurDate.getFullYear();
var giMonth = gdCurDate.getMonth()+1;
var giDay = gdCurDate.getDate();
var VicPopCal = new Object();
//****************************************************************************
// Param: popCtrl is the widget beyond which you want this calendar to appear;
//    dateCtrl is the widget into which you want to put the selected date;
//    popCal is the widget to display the calendar; 
// i.e.: <input type="text" name="dc" style="text-align:center" readonly><INPUT type="button" value="V" onclick="fPopCalendar(dc,dc,popCal);return false">
//****************************************************************************
function fPopCalendar(popCtrl, dateCtrl, popCal){
 parent.event.cancelBubble=true;
 VicPopCal = popCal;
 gdCtrl = dateCtrl;
 fSetYearMon(giYear, giMonth);
 var point = fGetXY(popCtrl);
 with (VicPopCal.style) {
 left = point.x;
top = point.y+popCtrl.offsetHeight+1;
visibility = ’visible’;
 }
 xywf(VicPopCal) ;
 // in order to make compatible with IE4.x , here I cut two line below off.
 // VicPopCal.all("popFrame").width=document.all("popTable").offsetWidth;
 // VicPopCal.all("popFrame").height=document.all("popTable").offsetHeight;
 // if u only target on IE5.x, uncommented them and delete the width&height prop in <IFrame> tag
 // thus you will find the 3rd para in fDrawCal() now works perfectly.
}
function fSetDate(iYear, iMonth, iDay){
 gdCtrl.value = iMonth+"-"+iDay+"-"+iYear; //Here, you could modify the locale as you need !!!!
 VicPopCal.style.visibility = "hidden";
}
function fSetSelected(aCell){
 var iOffset = 0;
 var iYear = parseInt(tbSelYear.value);
 var iMonth = parseInt(tbSelMonth.value);
 aCell.bgColor = gcBG;
 with (aCell.children["cellText"]){
 var iDay = parseInt(innerText);
 if (color==gcGray)
 iOffset = (Victor<10)?-1:1;
iMonth += iOffset;
if (iMonth<1) {
 iYear--;
 iMonth = 12;
}else if (iMonth>12){
 iYear++;
 iMonth = 1;
}
 }
 fSetDate(iYear, iMonth, iDay);
}
function Point(iX, iY){
this.x = iX;
this.y = iY;
}
function fBuildCal(iYear, iMonth) {
 var aMonth=new Array();
 for(i=1;i<7;i++)
 aMonth[i]=new Array(i);
 var dCalDate=new Date(iYear, iMonth-1, 1);
 var iDayOfFirst=dCalDate.getDay();
 var iDaysInMonth=new Date(iYear, iMonth, 0).getDate();
 var iOffsetLast=new Date(iYear, iMonth-1, 0).getDate()-iDayOfFirst+1;
 var iDate = 1;
 var iNext = 1;
 for (d = 0; d < 7; d++)
aMonth[1][d] = (d<iDayOfFirst)?-(iOffsetLast+d):iDate++;
 for (w = 2; w < 7; w++)
 for (d = 0; d < 7; d++)
 aMonth[w][d] = (iDate<=iDaysInMonth)?iDate++:-(iNext++);
 return aMonth;
}
function fDrawCal(iYear, iMonth, iCellWidth, iDateTextSize) {
 var WeekDay = new Array("Su","Mo","Tu","We","Th","Fr","Sa");
 var styleTD = " bgcolor=’"+gcBG+"’ width=’"+iCellWidth+"’ bordercolor=’"+gcBG+"’ valign=’middle’ align=’center’ style=’font:bold "+iDateTextSize+" Courier;";      //Coded by Liming Weng(Victor Won) email:victorwon@netease.com
 with (document) {
write("<tr>");
for(i=0; i<7; i++)
 write("<td "+styleTD+"color:#990099’ >" + WeekDay[i] + "</td>");
write("</tr>");
 for (w = 1; w < 7; w++) {
 write("<tr>");
 for (d = 0; d < 7; d++) {
 write("<td id=calCell "+styleTD+"cursor:hand;’ onMouseOver=’this.bgColor=gcToggle’ onMouseOut=’this.bgColor=gcBG’ onclick=’fSetSelected(this)’>");
 write("<font id=cellText Victor=’Liming Weng’> </font>");
 write("</td>")
 }
 write("</tr>");
}
 }
}
function fUpdateCal(iYear, iMonth) {
 myMonth = fBuildCal(iYear, iMonth);
 var i = 0;
 for (w = 0; w < 6; w++)
for (d = 0; d < 7; d++)
 with (cellText[(7*w)+d]) {
 Victor = i++;
 if (myMonth[w+1][d]<0) {
  color = gcGray;
  innerText = -myMonth[w+1][d];
 }else{
  color = ((d==0)||(d==6))?"red":"black";
  innerText = myMonth[w+1][d];
 }
 }
}
function fSetYearMon(iYear, iMon){
 tbSelMonth.options[iMon-1].selected = true;
 for (i = 0; i < tbSelYear.length; i++)
if (tbSelYear.options[i].value == iYear)
 tbSelYear.options[i].selected = true;
 fUpdateCal(iYear, iMon);
}
function fPrevMonth(){
 var iMon = tbSelMonth.value;
 var iYear = tbSelYear.value;
 if (--iMon<1) {
  iMon = 12;
  iYear--;
 }
 fSetYearMon(iYear, iMon);
}
function fNextMonth(){
 var iMon = tbSelMonth.value;
 var iYear = tbSelYear.value;
 if (++iMon>12) {
  iMon = 1;
  iYear++;
 }
 fSetYearMon(iYear, iMon);
}
function fGetXY(aTag){
 var oTmp = aTag;
 var pt = new Point(0,0);
 do {
 pt.x += oTmp.offsetLeft;
 pt.y += oTmp.offsetTop;
 oTmp = oTmp.offsetParent;
 } while(oTmp.tagName!="BODY");
 return pt;
}
var gMonths = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
with (document) {
write("<table id=’popTable’ border=’0’ bgcolor=’#6699cc’>");
write("<TR>");
write("<td valign=’middle’ align=’center’><input type=’button’ name=’PrevMonth’ value=’<’ style=’height:20;width:20;FONT:16 Fixedsys’ onClick=’fPrevMonth()’>");
write("&nbsp;<select name=’tbSelMonth’ onChange=’fUpdateCal(tbSelYear.value, tbSelMonth.value)’ Victor=’Won’>");
for (i=0; i<12; i++)
write("<option value=’"+(i+1)+"’>"+gMonths[i]+"</option>");
write("</SELECT>");
write("&nbsp;<SELECT name=’tbSelYear’ onChange=’fUpdateCal(tbSelYear.value, tbSelMonth.value)’ Victor=’Won’>");
for(i=1990;i<2015;i++)
write("<OPTION value=’"+i+"’>"+i+"</OPTION>");
write("</SELECT>");
write("&nbsp;<input type=’button’ name=’PrevMonth’ value=’>’ style=’height:20;width:20;FONT:16 Fixedsys’ onclick=’fNextMonth()’>");
write("</td>");
write("</TR><TR>");
write("<td align=’center’>");
write("<DIV style=’background-color:teal;’><table width=’100%’ border=’0’ cellpadding=’2’>");
fDrawCal(giYear, giMonth, 19, 12);
write("</table>");
write("</td>");
write("</TR><TR><TD align=’center’>");
write("<font style=’cursor:hand;font:12 Fixedsys’ onclick=’fSetDate(giYear,giMonth,giDay)’ onMouseOver=’this.style.color=gcToggle’ onMouseOut=’this.style.color=0’>Today:&nbsp;&nbsp;"+gMonths[giMonth-1]+"&nbsp;"+giDay+",&nbsp;"+giYear+"</font>");
write("</TD></TR>");write("</TD></TR>");
write("</TABLE>");
}
// End -- Coded by Liming Weng, email: victorwon@netease.com -->
</script>
</li>
<li style="margin-top:20px; line-height:18px; text-align:left; padding-left:10px;margin-left:0px;"><br />
<p>以上内容由 <a href="http://www.sudu.cn">华夏名网</a> 搜集整理,如转载请注明原文出处,并保留这一部分内容。</p>
<table width="98%" border="1" cellpadding="4" cellspacing="0" bordercolor="#333333" style="border-collapse:collapse">
 <tr>
  <td bgcolor="#eeeeee">  “华夏名网” http://www.sudu.cn 和 http://www.bigwww.com 是成都飞数科技有限公司的网络服务品牌,专业经营虚拟主机,域名注册,VPS,服务器租用业务。公司创建于2002年,经过6年的高速发展,“华夏名网”已经成为我国一家知名的互联网服务提供商,被国外权威机构webhosting.info评价为25大IDC服务商之一。</td>
 </tr>
</table>
<p>华夏名网网址导航: <a href="http://www.sudu.cn/webhosting">虚拟主机</a> <a href="http://www.sudu.cn/webhosting">双线主机</a> <a href="http://www.sudu.cn/webhosting">主机</a> <a href="http://www.sudu.cn/domain">域名注册</a> <a href="http://www.sudu.cn/domain">cn域名</a> <a href="http://www.sudu.cn/domain">域名</a> <a href="http://www.sudu.cn/server">服务器租用</a> <a href="http://www.sudu.cn/server">酷睿服务器</a> <a href="http://www.sudu.cn/vps">vps</a> <a href="http://www.sudu.cn/vps">vps主机</a></p></li>
<li style="text-align:left; margin-top:15px; padding-left:10px; margin-left:0px;">
(阅读次数:171)</li>
<li style="margin-top:10px;margin-left:0px;">上一篇:
<a href="/info/html/edu/20071121/7249.html">内核空间SMP编程</a>  下一篇:
<a href="/info/html/edu/20071121/7251.html">RSA加密实例分析</a>
</li>
<li style="border:#CCCCCC solid 1px; height:28px!important;height:30px; margin-top:10px; padding-top:10px;margin-left:0px;">[<img src="/info/article/img/file_move.gif" width="17" height="18" align="absmiddle"><A href="http://j5c.ddvip.com/index.php#" onClick="window.external.AddFavorite('http://www.idcnews.net','');">收藏</A>] [<img src="/info/article/img/menuarrow.gif" width="16" height="15" align="absmiddle">推荐] [<img src="/info/article/img/menumember.gif" width="16" height="15" align="absmiddle"><a href="/info/article/feedBack.php/aId_7250.html">评论</a>] [<a href="http://j5c.ddvip.com/index.php#" onClick="window.print()">打印本页</a>] [<a href="http://j5c.ddvip.com/index.php#" onClick="history.go(-1)">返回上一页</a>][<a onClick="window.close()" href="http://j5c.ddvip.com/index.php#">关闭窗口</a>] </li>
<form action="/info/article/articleInfo.php?action=addInfoReview" method="post" name='form2' id='form2'>
<li style="margin-top:10px; text-align:left;margin-left:10px;">昵称:
 <label>
 <input name="tineName" type="text" id="tineName" value="游客" size="20">
 </label>
 (为空则显示guest) </li>
 <li style="margin-top:10px; text-align:left;margin-left:10px;">评论分数:
  <input type="radio" name="score" value="1">
  <span class="STYLE1">★</span>
  <input type="radio" name="score" value="2">
  <span class="STYLE1">★
  ★</span>
  <input name="score" type="radio" value="3" checked>
  <span class="STYLE1">★★★</span>
  <input type="radio" name="score" value="4">
  <span class="STYLE1">★★★★</span>
  <input type="radio" name="score" value="5">
  <span class="STYLE1">★★★★★</span>
  <input name="aId" type="hidden" id="aId" value="7250">
 </li>
 <li style="margin-top:10px; text-align:left; margin-left:10px;">评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。</li>
<li style="margin-top:10px; text-align:left;margin-left:10px;">
 <label>
 <textarea name="reviewContent" cols="70" rows="6" id="reviewContent" class="revContet"> 本文作者:未知

添加到QQ书签 百度收藏 订阅到抓虾 添加到鲜果  新浪ViVi  365Key网摘  天极网摘  我摘  和讯网摘  yahoo  收藏到收客网  Digbuzz我挖网  添加到饭否  挖客  添加到google  

   【回到顶部】 【返回文章列表】 编辑:优内科技
⊕ 上一篇:网页中Javascript代码的应用方式
⊕ 下一篇:传统的JavaScript事件处理函数
  相关新闻
返回首页 | 设为首页 | 添加收藏 | 关于我们 | 联系我们 | 企业文化 | 合作伙伴 | 诚聘英才 | 网站报价 | 企业资质 | 网站地图
邮箱登陆 E- mail:master@cck5.com 点击这里给我发消息 客服专员 QQ:310203268 点击这里给我发消息 技术咨询 QQ:22071287点击这里给我发消息 代理备案 QQ:529631515
丰富的网站建设经验,专业提供网站建设、网站制作、网页设计服务,专业设计,真诚服务,不满意不收费!
Copyright 2008 - 2025 cck5 Inc. All Rights Reserved 优内建站网络科技公司
本站部分资源来自网络,如有侵犯您的版权,请告之,我们将即刻删除!QQ:310203268
主要业务:网站建设企业建站专业建站智能建站SEO优化微信建站手机建站
本站ICP备案号:浙ICP备11019299号 中国电信增值ICP经营许可证
不良信息举报中心 江西网警 信息产业部门备案 企业法人营业执照
 
扫优内微信二维码
“码”上有惊喜