⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 time34.htm

📁 javascript各种效果的实例及源代码
💻 HTM
字号:
<html>
<head>
<title>Form中时间显示</title>
<style type="text/css">
<!--
body {  font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 0px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }
 A:hover { COLOR: red; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active     { font: 9pt "宋体"; cursor: hand; color: #FF0033 }

-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#fef4d9">
<br>
<br>
<center><font color=red face="隶书" size=6>Form中时间显示</font></center>
<br>
<center>
<table border=5 bordercolor=blue borderlight=green>
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>下面为效果显示区!</strong></font></td></tr><tr><td align=center><FORM>
<SELECT NAME="dates" SIZE=1>
<SCRIPT LANGUAGE="JavaScript">

//--------------------------------------------
// By mattias.sjoberg@swipnet.se 26/7-97
// The JavaScript Planet
// http://www.geocities.com/SiliconValley/7116
// You're welcome to use/edit this script,
// just keep the comments and drop me a note.
//--------------------------------------------

        today = new Date();
        thismonth = today.getMonth() + 1;
        thisyear = today.getYear();
        thisday = today.getDate();

        maxdays=31;//default

        // months with 30 days
        if (thismonth==4 || thismonth==6 || thismonth==9 || thismonth==11)
        {
                maxdays=30
        }

        // february, leap year
        if (thismonth==2)
        {
                // feb
                if ((thisyear/4)!=parseInt(thisyear/4))
                {
                        maxdays=28
                }
                else
                {
                        //leap year
                        maxdays=29
                }
        }

        thismonth = "" + thismonth
        if (thismonth.length == 1)
        {
                thismonth = "0" + thismonth;
        }

        for (var theday = 0; theday <= maxdays; theday++)
        {
                if (theday == 0)
                {
                        document.write ("<OPTION SELECTED> "+ thisday + "-" + thismonth + "-" + thisyear )
                        document.write ("<OPTION> ========")
                }
                else
                {
                        var thed = "" + theday
                        if (thed.length == 1)
                        {
                                thed = "0" + thed;
                        }
                        document.write ("<OPTION> " + thed + "-" + thismonth + "-" + thisyear)
                }
        }

</SCRIPT>
</SELECT>
</FORM>
</td></tr>
</table></center>
   
<br>
<br>
<center>
<textarea name=source rows=12 cols=45 class=yk9>
脚本说明:
把如下代码加入<body>区域中
<FORM>
<SELECT NAME="dates" SIZE=1>
<SCRIPT LANGUAGE="JavaScript">

//--------------------------------------------
// By mattias.sjoberg@swipnet.se 26/7-97
// The JavaScript Planet
// http://www.geocities.com/SiliconValley/7116
// You're welcome to use/edit this script,
// just keep the comments and drop me a note.
//--------------------------------------------

        today = new Date();
        thismonth = today.getMonth() + 1;
        thisyear = today.getYear();
        thisday = today.getDate();

        maxdays=31;//default

        // months with 30 days
        if (thismonth==4 || thismonth==6 || thismonth==9 || thismonth==11)
        {
                maxdays=30
        }

        // february, leap year
        if (thismonth==2)
        {
                // feb
                if ((thisyear/4)!=parseInt(thisyear/4))
                {
                        maxdays=28
                }
                else
                {
                        //leap year
                        maxdays=29
                }
        }

        thismonth = "" + thismonth
        if (thismonth.length == 1)
        {
                thismonth = "0" + thismonth;
        }

        for (var theday = 0; theday <= maxdays; theday++)
        {
                if (theday == 0)
                {
                        document.write ("<OPTION SELECTED> "+ thisday + "-" + thismonth + "-" + thisyear )
                        document.write ("<OPTION> ========")
                }
                else
                {
                        var thed = "" + theday
                        if (thed.length == 1)
                        {
                                thed = "0" + thed;
                        }
                        document.write ("<OPTION> " + thed + "-" + thismonth + "-" + thisyear)
                }
        }

</SCRIPT>
</SELECT>
</FORM>
</textarea>

<SCRIPT LANGUAGE="JavaScript">

<!-- hide

function goHist(a) 

{

   history.go(a);

}

//-->

</script>
<br>
<FORM METHOD="post">
<INPUT TYPE="button" VALUE="返回" onClick="goHist(-1)" style="background-color: #8000FF; color: rgb(255,255,255)">
</form>
</center>
<br>
<br>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -