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

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

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



if (showToday==1)
{
document.write ("<tr bgcolor=#f0f0f0><td style='padding:5px' align=center><span id='lblToday'></span></td></tr>")
}

document.write ("</table></div><div id='selectMonth' style='z-index: 999;position:absolute;visibility:hidden;'></div><div id='selectYear' style='z-index: 999;position:absolute;visibility:hidden;'></div>");
}

var monthName = new Array("01","02","03","04","05","06","07","08","09","10","11","12")
var monthName2 = new Array("01","02","03","04","05","06","07","08","09","10","11","12")
if (startAt==0)
{
dayName = new Array ("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
}
else
{
dayName = new Array ("Mon","Tue","Wed","Thu","Fri","Sat","Sun")
}
var styleAnchor="text-decoration:none;color:black;"
var styleLightBorder="border-style:solid;border-width:1px;border-color:#a0a0a0;"

function swapImage(srcImg, destImg)
{
if (ie)
{
document.getElementById(srcImg).setAttribute("src",imgDir destImg)
}
}

function init()
{
if (!ns4)
{
if (!ie)
{
yearNow = 1900
}

crossobj=(dom)?document.getElementById("calendar").style : ie? document.all.calendar : document.calendar
hideCalendar()

crossMonthObj=(dom)?document.getElementById("selectMonth").style : ie? document.all.selectMonth : document.selectMonth

crossYearObj=(dom)?document.getElementById("selectYear").style : ie? document.all.selectYear : document.selectYear

monthConstructed=false;
yearConstructed=false;

if (showToday==1)
{
document.getElementById("lblToday").innerHTML = todayString " <a onmousemove='window.status=\"" gotoString "\"' onmouseout='window.status=\"\"' title='" gotoString "' style='" styleAnchor "' href='javascript:monthSelected=monthNow;yearSelected=yearNow;constructCalendar();'>" dayName[(today.getDay()-startAt==-1)?6:(today.getDay()-startAt)] ", " dateNow " " monthName[monthNow].substring(0,3) " " yearNow "</a>"
}

sHTML1="<span id='spanLeft' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\"changeLeft\",\"left2.gif\");this.style.borderColor=\"#88AAFF\";window.status=\"" scrollLeftMessage "\"' onclick='javascript:decMonth()' onmouseout='clearInterval(intervalID1);swapImage(\"changeLeft\",\"left1.gif\");this.style.borderColor=\"#3366FF\";window.status=\"\"' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"StartDecMonth()\",500)' onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'>&nbsp<IMG id='changeLeft' SRC='" imgDir "left1.gif' width=10 height=11 BORDER=0>&nbsp</span>&nbsp;"
sHTML1 ="<span id='spanRight' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\"changeRight\",\"right2.gif\");this.style.borderColor=\"#88AAFF\";window.status=\"" scrollRightMessage "\"' onmouseout='clearInterval(intervalID1);swapImage(\"changeRight\",\"right1.gif\");this.style.borderColor=\"#3366FF\";window.status=\"\"' onclick='incMonth()' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"StartIncMonth()\",500)' onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'>&nbsp<IMG id='changeRight' SRC='" imgDir "right1.gif' width=10 height=11 BORDER=0>&nbsp</span>&nbsp"
sHTML1 ="<span id='spanMonth' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\"changeMonth\",\"drop2.gif\");this.style.borderColor=\"#88AAFF\";window.status=\"" selectMonthMessage "\"' onmouseout='swapImage(\"changeMonth\",\"drop1.gif\");this.style.borderColor=\"#3366FF\";window.status=\"\"' onclick='popUpMonth()'></span>&nbsp;"
sHTML1 ="<span id='spanYear' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\"changeYear\",\"drop2.gif\");this.style.borderColor=\"#88AAFF\";window.status=\"" selectYearMessage "\"' onmouseout='swapImage(\"changeYear\",\"drop1.gif\");this.style.borderColor=\"#3366FF\";window.status=\"\"' onclick='popUpYear()'></span>&nbsp;"

document.getElementById("caption").innerHTML = sHTML1

bPageLoaded=true
}
}

function hideCalendar()
{
crossobj.visibility="hidden"
if (crossMonthObj != null)
{
crossMonthObj.visibility="hidden"
}
if (crossYearObj != null)
{
crossYearObj.visibility="hidden"
}

showElement( 'SELECT' );
showElement( 'APPLET' );
}

function padZero(num)
{
return (num < 10)? '0' num : num ;
}

function constructDate(d,m,y)
{
sTmp = dateFormat
sTmp = sTmp.replace ("dd","<e>")
sTmp = sTmp.replace ("d","<d>")
sTmp = sTmp.replace ("<e>",padZero(d))
sTmp = sTmp.replace ("<d>",d)

标签:

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

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

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