一个兼容IE、Firefox和Opera浏览器的英文日历脚…

2008-02-23 07:50:03来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折


sTmp = sTmp.replace ("mmmm","<p>")
sTmp = sTmp.replace ("mmm","<o>")
sTmp = sTmp.replace ("mm","<n>")
sTmp = sTmp.replace ("m","<m>")
sTmp = sTmp.replace ("<m>",m 1)
sTmp = sTmp.replace ("<n>",padZero(m 1))
sTmp = sTmp.replace ("<o>",monthName[m])
sTmp = sTmp.replace ("<p>",monthName2[m])
sTmp = sTmp.replace ("yyyy",y)
return sTmp.replace ("yy",padZero(y0))
}

function closeCalendar()
{
var sTmp

hideCalendar();
ctlToPlaceValue.value = constructDate(dateSelected,monthSelected,yearSelected)
}

/*** Month Pulldown ***/

function StartDecMonth()
{
intervalID1=setInterval("decMonth()",80)
}

function StartIncMonth()
{
intervalID1=setInterval("incMonth()",80)
}

function incMonth ()
{
monthSelected
if (monthSelected>11)
{
monthSelected=0
yearSelected
}
constructCalendar()
}

function decMonth ()
{
monthSelected--
if (monthSelected<0)
{
monthSelected=11
yearSelected--
}
constructCalendar()
}

function upMonth()
{
if(nStartingMonth > 0)
{
nStartingMonth --;
for (i=0; i<6; i )
{
newMonth = (i nStartingMonth);
if (newMonth == monthSelected)
txtMonth = "&nbsp;<B>" monthName[newMonth] "</B>&nbsp;";
else
txtMonth = "&nbsp;" monthName[newMonth] "&nbsp;";
document.getElementById("m" i).innerHTML = txtMonth;
}
}
bShow=true
}

function downMonth()
{
if(nStartingMonth < 6)
{
nStartingMonth ;
for (i=0; i<6; i )
{
newMonth = (i nStartingMonth);
if (newMonth == monthSelected)
txtMonth = "&nbsp;<B>" monthName[newMonth] "</B>&nbsp;";
else
txtMonth = "&nbsp;" monthName[newMonth] "&nbsp;";
document.getElementById("m" i).innerHTML = txtMonth;
}
}
bShow=true
}


function selectMonth(nMonth)
{
monthSelected=parseInt(nMonth nStartingMonth);
monthConstructed=false;
constructCalendar();
popDownMonth();
}

function constructMonth()
{
popDownYear()
if (!monthConstructed)
{

sHTML = "<tr><td align='center' onmouseover='this.style.backgroundColor=\"#FFCC99\"' onmouseout='clearInterval(intervalID1);this.style.backgroundColor=\"\"' style='cursor:pointer' onmousedown='clearInterval(intervalID1);intervalID1=setInterval(\"upMonth()\",30)' onmouseup='clearInterval(intervalID1)'>-</td></tr>"

j=0;
i=(monthSelected-3);
if(i < 0)
i=0;
if(i > 6)
i=6;
nStartingMonth = i;
for (ii=0; ii<6; ii , i , j )
{
sName = monthName[i];
if (i==monthSelected)
{
sName = "<B>" sName "</B>"
}
sHTML = "<tr><td id='m" j "' onmouseover='this.style.backgroundColor=\"#FFCC99\"' onmouseout='this.style.backgroundColor=\"\"' style='cursor:pointer' onclick='selectMonth(" j ");event.cancelBubble=true'>&nbsp;" sName "&nbsp;</td></tr>"
}

sHTML = "<tr><td align='center' onmouseover='this.style.backgroundColor=\"#FFCC99\"' onmouseout='clearInterval(intervalID2);this.style.backgroundColor=\"\"' style='cursor:pointer' onmousedown='clearInterval(intervalID2);intervalID2=setInterval(\"downMonth()\",30)' onmouseup='clearInterval(intervalID2)'> </td></tr>"

document.getElementById("selectMonth").innerHTML = "<table width=32 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#FFFFDD' cellspacing=0 onmouseover='clearTimeout(timeoutID1)' onmouseout='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"popDownMonth()\",100);event.cancelBubble=true'>" sHTML "</table>"

monthConstructed=true
}
}
function popUpMonth()
{
constructMonth()
crossMonthObj.visibility = (dom||ie)? "visible" : "show"
crossMonthObj.left = parseInt(crossobj.left) 50
crossMonthObj.top = parseInt(crossobj.top) 26

hideElement( 'SELECT', document.getElementById("selectMonth") );
hideElement( 'APPLET', document.getElementById("selectMonth") );
}

function popDownMonth()
{
crossMonthObj.visibility= "hidden"
}

/*** Year Pulldown ***/

function incYear()
{
for (i=0; i<6; i )
{
newYear = (i nStartingYear) 1
if (newYear==yearSelected)
{
txtYear = "&nbsp;<B>" newYear "</B>&nbsp;"
}
else
{
txtYear = "&nbsp;" newYear "&nbsp;"
}
document.getElementById("y" i).innerHTML = txtYear
}
nStartingYear ;
bShow=true

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:在JS文件中调用JS文件,可以不停的调用

下一篇:飘浮广告显示脚本类(VBS,JS双版)