100:“时间下拉选项”

qiaoyu 2002-05-13 03:35:14
有谁能详细说明“携程旅行网 ”(http://www.ctrip.com)里的“时间下拉选项”的,给100分,我的EMAIL:qiaoyu76@sohu.com
...全文
20 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
ssm1226 2002-05-13
date.js

=============================================
<!--
var g_MINY=1601;var g_MAXY=4500;var g_month=0;var g_day=0;var g_year=0;var g_yLow=1990;
function GetInputDate(t,f){
var l=t.length;
if(0==l)return false;
var cSp='\0';var sSp1="";var sSp2="";
for(var i=0;i<t.length;i++){
var c=t.charAt(i);
if(c==' '||isdigit(c))continue;
0Aelse if(cSp=='\0'&&(c=='/'||c=='-'||c=='.')){ cSp=c;sSp1=t.substring(i+1,l);}
else if(c==cSp)sSp2=t.substring(i+1,l);
else if(c!=cSp)return false;
}
if(0==sSp1.length)return false;
0A var m;var d;var y;
if(g_dFmt=="mmddyy"){m=atoi(t);d=atoi(sSp1);}
else{d=atoi(t);m=atoi(sSp1);}
if(0!=sSp2.length)y=atoi(sSp2);
else y=DefYr(m,d);
if(y<100){
y=1900+y;
while(y<g_yLow)y=y+100;}
if(y<g_MINY||y>g_MAXY||m<1||m>12)return false;
if(d<1||d>GetMonthCount(m,y))return false;
g_month=m;g_day=d;g_year=y;
return true;
}

function DefYr(m,d){
var dt=new Date();
var yCur=(dt.getYear()<1000)?1900+dt.getYear():dt.getYear();
0A if(m-1<dt.getMonth()||(m-13D=dt.getMonth()&&d<dt.getDate()))return 1+yCur;else return yCur;
}

function atoi(s){
var t=0;
for(var i=0;i<s.length;i++){
var c=s.charAt(i);
if(!isdigit(c))return t;
else t=t*10+(c-'0');
}
return t;
}

function isdigit(c){
return(c>='0'&&c<='9');
}

function GetMonthCount(m,y){0D var c=rgMC[m-1];
if((2==m)&&IsLeapYear(y))c++;
return c;
}

function IsLeapYear(y){
if(0==y4&&((y0!=0)||(y@0==0))) return true;else return false;
}

var rgMC=new Array(12);rgMC[0]=31;rgMC[1]=28;rgMC[2]=31;rgMC[3]=30;rgMC[4]=31;rgMC[5]=30;rgMC[6]=31;rgMC[7]=31;rgMC[8]=30;
rgMC[9]=31;rgMC[10]=30;rgMC[11]=31;
var g_eC=null;var g_eCV="";var g_dFmt="mmddyy";var g_fnCB=null;

function ShowCalendar(eP,eD,eDP,dmin,dmax,fnCB){
var dF=document.all.CalFrame;
var wF=window.frames.CalFrame;
if(null==wF.g_fCalLoaded||false==wF.g_fCalLoaded){
alert("Unable to load popup calendar.\r\nPlease reload the page.");
return;
}
dtMin=new Date();
dtMin.setDate(dtMin.getDate()+dmin);
dtMax=new Date();
dtMax.setDate(dtMax.getDate()+dmax);
wF.SetMinMax(new Date(dtMin),new Date(dtMax));
g_fnCB=fnCB;
wF.cityname(fnCB);
if(eD==g_eC&&"block"==dF.style.display){
if(g_eCV!=eD.value&&GetInputDate(eD.value,g_dFmt)){
wF.SetInputDate(g_day,g_month,g_year);
wF.SetDate(g_day,g_month,g_year);
g_eCV=eD.value;
}
else dF.style.display="none";
}
else{
if(GetInputDate(eD.value,g_dFmt)){
wF.SetInputDate(g_day,g_month,g_year);
wF.SetDate(g_day,g_month,g_year);
}
else if(null!=eDP&&GetInputDate(eDP.value,g_dFmt)){
wF.SetInputDate(g_day,g_month,g_year);
wF.SetDate(g_day,g_month,g_year);
}
else{
var dt=new Date(dtMin);
wF.SetInputDate(-1,-1,-1);0D wF.SetDate(dt.getDate(),dt.getMonth()+1,dt.getFullYear());
}
var eL=0;var eT=0;var p=eP;
while(p&&p.tagName!="BODY"){
eT+=p.offsetTop;
eL+=p.offsetLeft;
p=p.offsetParent;
}
var eH=eP.offsetHeight;
var dH=dF.style.pixelHeight;
var sT=document.body.scrollTop;
dF.style.left=eL;
if(eT-dH>=sT&&eT+eH+dH>document.body.clientHeight2BsT) dF.style.top=eT-dH;
else dF.style.top=eT+eH;
if("none"==dF.style.display) dF.style.display="block";g_eC=eD;g_eCV=eD.value;
}
}

function SetDate(d,m,y){
var ds="/";
g_eC.focus();
if(g_dFmt=="mmddyy") g_eC.value=m+ds+d+ds+y;
else g_eC.value=d+ds+m+ds+y;
g_eCV=g_eC.value;
if(null!=g_fnCB&&""!=g_fnCB) eval(g_fnCB);
}

function GetDowStart(){return 0;}

function GetDOW2(d,m,y){
var dt=new Date(y,m-1,d);
return(dt.getDay()+(7-GetDowStart()))7;
}

function LoadMonths(n){
var dt=new Date();
var m=dt.getMonth()+1;
var y=dt.getFullYear();
var rg=new Array(n);
for(i=0;i<n;i++){
rg[i]=document.createElement("IMG");
rg[i].src="/images/elements/calendar/w"2BGetDOW2(1,m,y)+"d"+GetMonthCount(m,y)+".gif";
m++;
if(12<m){ m=1;y++;}
}
}

LoadMonths(12);

function chkBrowser(){
this.ver=navigator.appVersion;
this.dom=document.getElementById?1:0;0D this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bVer=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
return this;
}

bVer=new chkBrowser();
ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;0D function AttB(f){if(bVer.ie4)f.style.display='block';}
function AttN(f){if(bVer.ie4)f.style.display='none';}

function show(idLayer,idParent){
cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;
cLayer.display='block';
divLinksForm=(ns4)?document.divLinks.document.divLinks:document.divLinks;
var d=document.Wiz;
if (idLayer=='car'){
AttB(d.CKind);AttB(d.Ctime1);AttB(d.Ctime2);d.srch[1].status='true';
}
else if (idLayer=='hot'){AttB(d.Hcadt);AttB(d.Hckid);d.srch[0].status='true';}
else{AttB(d.FcAdu);d.srch[2].status='true';/*if (idParent!='flt' && d.opts[1].checked) hide('dts','flt');*/}
}

function hide(idLayer,idParent){
cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;
var d=document.Wiz;
if(idLayer!='flt') AttN(d.FcAdu);
AttN(d.Hcadt);
AttN(d.Hckid);
AttN(d.CKind);
AttN(d.Ctime1);
AttN(d.Ctime2);
cLayer.display='none'
}
function jtp()
{
alert("ddd");
return;
}
//-->


回复
ssm1226 2002-05-13
<center>
<br>
<br>
<font face="arial" size="1">
关于此菜单
<br>
<br>
版权所有 Blood<br>
<br>
说明,此菜单程序只能使用在IE 5以上的版本使用,NetSpace下不能使用,推荐使用IE 6正式中文版
</center>
<hr>
<script event="onclick()" for="document">
<!--
//document.all.CalFrame.style.display="none";
//-->
</script>

<script src="date.js"></script>
<iframe id="CalFrame" style="DISPLAY: none; Z-INDEX: 100; WIDTH: 148px; POSITION: absolute; HEIGHT: 194px" marginWidth="0" marginHeight="0" src="calendar.htm" frameBorder="0" noResize scrolling="no"></iframe>

<form action="findhotel.asp" method="post" name="hotel">
<input class="text" maxLength="12" size="9" value="<>" name="arrive_date" onfocus="">
<a onclick="event.cancelBubble=true;" href="javascript:ShowCalendar(document.hotel.dimg3,document.hotel.arrive_date,null,0,330)"><img id="dimg3" style="POSITION: relative" width="56" height="21" src="canlendar.gif" align="top" border="0"></a></td>
<br>


</form>
回复
Bullforg 2002-05-13
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
input{font-family: "宋体"; font-size:9pt;height:15px;border:0px black solid;background:#f0f0f0;cursor:hand;background:none}
td{font-family: "宋体"; font-size:9pt;}
select{font-family: "宋体"; font-size:9pt;}
.input1{font-family: "宋体"; font-size:9pt;height:18px;line-height: 12pt;border:1px black solid;background:#e0e0e0}
</style>

</head>
<script language="javascript">
function checkinput()
{
while (isNaN(document.all.years.value) || (document.all.years.value==" "))
{
document.all.years.value=years.value.substring(0,years.value.length-1)
}
}

function numberofdays(month,year)
{
var numdays=new Array(31,28,31,30,31,30,31,31,30,31,30,31)
n=numdays[month]

if (month==1&&year%4==0) ++n

return n
}

function displaydates(day,month,year,shade){
d=new Date(year,month,1)
var startday=d.getDay()
var numdays=numberofdays(month,year)
var numrows=Math.ceil((numdays+startday)/7)

var tmps=""
if((numdays+startday)%7>1) ++numrows
var currentdate=0


tmps="<table border=0 cellpadding=0 cellspacing=0><tr><td align='center'>日</td><td align='center'>一</td><td align='center'>二</td><td align='center'>三</td><td align='center'>四</td><td align='center'>五</td><td align='center'>六</td></r>"
for (var i=0;i<numrows;++i)
{
tmps=tmps+"<tr>"
for(var j=0;j<7;++j){
if (shade&&day==currentdate&¤tdate<numdays&&i*7+j>=startday)
tmps=tmps+"<td bgcolor='#cccccc' style='border:1px solid #909090'>"
else tmps=tmps+"<td>"
if(currentdate>=numdays) tmps=tmps+" "
else if(currentdate>0){
++currentdate
tmps=tmps+writedate(currentdate)
} else if(i*7+j>=startday){
++currentdate
tmps=tmps+writedate(currentdate)
}else tmps=tmps+" "
tmps=tmps+"</td>"
}
tmps=tmps+"</tr>"
}
tmps=tmps+"</table>"
return tmps
}

function writedate(n){
return "<input type='button' value='"+n.toString()+"' style='width:20' onclick='setvalue("+n.toString()+")'>"
}

function setvalue(n)
{
document.all.dates.value=document.all.years.value+"-"+document.all.months.value+"-"+n
document.all.days.value=n.toString()
datesbox.style.visibility="hidden"
}

function showdates()
{

if ((event.x+150)>document.body.offsetWidth )
datesbox.style.left=event.x+document.body.scrollLeft-150
else
datesbox.style.left=event.x+document.body.scrollLeft
if ((event.y+165)>document.body.offsetHeight )
datesbox.style.top=event.y+document.body.scrollTop-165
else
datesbox.style.top=event.y+document.body.scrollTop
if (datesbox.style.visibility=="visible")
datesbox.style.visibility="hidden"
else
datesbox.style.visibility="visible"
yearadd(0)
}

function showdates2()
{
if (datesbox.style.visibility=="visible")
datesbox.style.visibility="hidden"
}

function changeit(d,m,y)
{
daysin.innerHTML=displaydates(d,m-1,y,true)
}

function yearadd(n)
{
years.value=(eval(years.value)+n).toString()

changeit(eval(days.value)-1,eval(months.value),eval(years.value))
}

</script>

<body style="font-size:9pt" bgcolor="6699CC">
<DIV id="datesbox" STYLE="border:1px solid #c0c0c0;padding:5px 5px 5px 5px;background:#f0f0f0;HEIGHT:165px; LEFT: 50px; POSITION: absolute; TOP: 31px; VISIBILITY: hidden; WIDTH: 150px" ondblclick='showdates2()'>
<table border=0 cellspacing=0 cellpadding=0><tr><td rowspan=2 align="center"> <input type="hidden" size="2" name="days" value=""><select name="months" onchange="changeit(eval(days.value)-1,eval(months.value),eval(years.value))" style="length:320"><option value=1 selected
>一月</option>
<option value=2>二月</option>
<option value=3>三月</option>
<option value=4>四月</option>
<option value=5>五月</option>
<option value=6>六月</option>
<option value=7>七月</option>
<option value=8>八月</option>
<option value=9>九月</option>
<option value=10>十月</option>
<option value=11>十一月</option>
<option value=12>十二月</option>
</select></td><td rowspan=2 style="padding-right:1px"> <input name="years" size=4 value="0" class="input1" onkeyup="checkinput();changeit(eval(days.value),eval(months.value),eval(years.value))" onblur="checkinput()" maxlength=4></td><td><input type="button" name="yearup" class="input1" onclick="yearadd(1)" style="height:9px;width:15px"></td>
</tr>
<tr><td><input type="button" name="yeardown" class="input1" value="v" style="height:9px;width:15px" onclick="yearadd(-1)"></td>
</tr>
</table><hr size=1 width="100%" color="#c0c0c0">
<div id=daysin></div>

</DIV>
<form action="getvalue.asp" method="post">
日期:<input name="dates" class="input1" readonly style="font-color:black"> <input type="button" class="input1" name="btndate" value="..." onclick="showdates()">
<input type="submit" value="查询" class="input1">
</form>
<script language="javascript">
function initdates()
{
var d=new Date()

days.value=d.getDate()
months.value=d.getMonth()+1
years.value=d.getYear()
document.all.dates.value=d.getYear().toString()+"-"+(d.getMonth()+1).toString()+"-"+(d.getDate()).toString()
daysin.innerHTML=displaydates(d.getDate()-1,d.getMonth(),d.getYear(),true)
}
initdates()
</script>
----- login.asp <%=Request.Form("dates")
%>
回复
wangfei2428 2002-05-13
不过也挺好的嘛,值得学习
回复
ChinaOk 2002-05-13
还要注册。真麻烦。
回复
MeXP 2002-05-13
蛮好的嘛
我来学学,保存
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2002-05-13 03:35
社区公告
暂无公告