网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > 代码交流
User Name
Password
 
FAQ Members List Calendar Cheap Glasses Mark Forums Read

代码交流 ASP,PHP,JSP等网站源代码下载与交流。

Reply
 
Thread Tools Display Modes
  #1   IP: 218.2.29.60
Old 2006-12-15, 07:27 PM
smiling smiling is offline
高级会员
 
Join Date: 2006-02-12
Posts: 502
smiling 正向着好的方向发展
Default 一个非常精彩的日历程序

我们经常需要的一些Web项目中用到日历,这样的脚本写起来又麻烦,功能又不够强大,现在豆腐给大家
提供一个功能强大的日历程序,这段脚本使用完全的客户端的js脚本制作,运行速度快。
下面大家就来看看,还有什么需要改进的地方,先看看效果再说吧!日历演示


豆腐日历



.normal{BACKGROUND: #ffffff}
.today {font-weight:bold;BACKGROUND: #6699cc}
.satday{color:green}
.sunday{color:red}
.days {font-weight:bold}


//中文月份,如果想显示英文月份,修改下面的注释
/*var months = new Array(January?, February?, March,
April, May, June, July, August, September,
October, November, December);*/
var months = new Array(一月, 二月, 三月,
四月, 五月, 六月, 七月, 八月, 九月,
十月, 十一月, 十二月);
var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,
30, 31, 30, 31);
//中文周 如果想显示 英文的,修改下面的注释
/*var days = new Array(Sunday, Monday, Tuesday,
Wednesday, Thursday, Friday, Saturday);*/
var days = new Array(日,一, 二, 三,
四, 五, 六);
function getDays(month, year) {
//下面的这段代码是判断当前是否是闰年的
if (1 == month)
return ((0 == year % 4) && (0 != (year % 100))) ||
(0 == year % 400) ? 29 : 28;
else
return daysInMonth[month];
}

function getToday() {
//得到今天的年,月,日
this.now = new Date();
this.year = this.now.getFullYear();
this.month = this.now.getMonth();
this.day = this.now.getDate();
}


today = new getToday();

function newCalendar() {

today = new getToday();
var parseYear = parseInt(document.all.year
[document.all.year.selectedIndex].text);
var newCal = new Date(parseYear,
document.all.month.selectedIndex, 1);
var day = -1;
var startDay = newCal.getDay();
var daily = 0;
if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth()))
day = today.day;
var tableCal = document.all.calendar.tBodies.dayList;
var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear());
for (var intWeek = 0; intWeek

if ((daily > 0) && (daily

function getDate() {
var sDate;
//这段代码处理鼠标点击的情况
if (TD == event.srcElement.tagName)
if ( != event.srcElement.innerText)
{
sDate = document.all.year.value + 年 + document.all.month.value + 月 + event.srcElement.innerText + 日;
alert(sDate);
}
}



豆腐制作,都是精品

豆腐技术站为大家提供最新最好的技术







for (var intLoop = 0; intLoop +
months[intLoop]);





for (var intLoop = today.year-50; intLoop +
intLoop);







document.write( + days[0] + );
for (var intLoop = 1; intLoop + days[intLoop] + );
document.write( + days[intLoop] + );





for (var intWeeks = 0; intWeeks );
for (var intDays = 0; intDays );
document.write();
}









function Cancel() {
document.all.ret.value = ;
window.close();
}
Reply With Quote
  #2   IP: 218.2.29.60
Old 2006-12-15, 07:28 PM
smiling smiling is offline
高级会员
 
Join Date: 2006-02-12
Posts: 502
smiling 正向着好的方向发展
Default 利用static实现表格的颜色隔行显示

利用static实现表格的颜色隔行显示
在实际编程应用中我们对STATIC的功能经常遗忘。要好好反省。。:)



我们用PHP从数据库查询数据,并将结果输出到浏览器上,如果结果有很多行,表格的bgcolor如果全是单色的,浏览者会感觉不太舒服。那麽怎样做使表格各行的颜色不同呢?
请看下面:


print(n);//下面输出10行
for($i=0;$in);
print($in);
print();
}
print(n);
说明:
此程序中定义了一个静态变量static $colorvalue意思是在函数调用结束后,
此变量$colorvalue还保留值,没有消失。当再次调用getcolor()函数时,变量$colorvalue的值是上次函数调用结束时$colorvalue的值。
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 12:25 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.