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

📄 js29.htm

📁 搜集的很多javascript实例及教程
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!--Saved  from《网页设计师》pageone.yeah.net,作者:阿捷ajie@nease.net-->
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="Javascript,Javascript,Javascript,Javascript,Javascript">
<!--  以下代码是设定此页的超链接样式    -->
<style type="text/css"><!-- A:link {text-decoration: none; color:#000000}
     A:visited {text-decoration: none; color: #000000}
     A:active {text-decoration: none; color: #FF0000}
     A:hover {text-decoration: underline; color: FF0000}
       body{font-size=9pt}
	        TH{FONT-SIZE: 9pt}
           TD{ FONT-SIZE: 9pt}
       -->
</style>
<title>含记事功能的日历</title>
</head>

<body bgcolor="#FFFFFF">

<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50%" bgcolor="#006DA2"><!--webbot bot="ImageMap" rectangle="(8,2) (105,34) http://www.pageone.yeah.net" src="../images/jlogo3.GIF" alt="网页设计师" border="0" width="111" height="36" startspan --><MAP NAME="FrontPageMap"><AREA SHAPE="RECT" COORDS="8, 2, 105, 34" HREF="http://www.pageone.yeah.net"></MAP><a href="../_vti_bin/shtml.exe/js/js29.htm/map"><img ismap usemap="#FrontPageMap" border="0" height="36" alt="网页设计师" src="../images/jlogo3.GIF" width="111"></a><!--webbot bot="ImageMap" endspan i-checksum="13194" --></td>
    <td width="50%" bgcolor="#006DA2"><p align="right"><br>
    <a href="js28.htm">上一页</a> <a href="js3.htm">下一页</a> <a href="../index.html">返回首页</a></td>
  </tr>
</table>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="5%" bgcolor="#B7D1F4" valign="top"></td>
    <td width="16%" bgcolor="#006DA2" valign="top"><table border="0" width="100%" cellspacing="4" cellpadding="0">
      <tr>
        <td width="16%"></td>
        <td width="84%"></td>
      </tr>
      <tr>
        <td width="16%"><font color="#ffff80">★</font></td>
        <td width="84%"><font face="Arial"><a href="index.htm">JAVASCRIPT</a></font></td>
      </tr>
      <tr>
        <td width="16%"><font color="#ffff80">★</font></td>
        <td width="84%"><font face="Arial"><a href="../frontpage/index.htm">FRONTPAGE</a></font></td>
      </tr>
      <tr>
        <td width="16%"><font color="#ffff80">★</font></td>
        <td width="84%"><font face="Arial"><a href="../dhtml/index.htm">DHTML</a></font></td>
      </tr>
      <tr>
        <td width="16%"><font color="#ffff80">★</font></td>
        <td width="84%"><font face="Arial"><a href="../photoshop/index.htm">PHOTOSHOP</a></font></td>
      </tr>
      <tr>
        <td width="16%"><font color="#ffff80">★</font></td>
        <td width="84%"><font face="Arial"><a href="../fireworks/index.htm">FIREWORKS</a></font></td>
      </tr>
      <tr>
        <td width="16%"><font color="#ffff80">★</font></td>
        <td width="84%"><font face="Arial"><a href="../flash/index.htm">FLASH</a></font></td>
      </tr>
      <tr>
        <td width="16%"><font color="#ffff80">★</font></td>
        <td width="84%"><font face="Arial"><a href="../cgi/index.htm">CGI</a></font></td>
      </tr>
      <tr>
        <td width="16%" a><font color="#ffff80">★</font></td>
        <td width="84%"><font face="Arial"><a href="../download/index.htm">DOWNLOAD</a></font></td>
      </tr>
      <tr>
        <td width="16%"></td>
        <td width="84%"></td>
      </tr>
    </table>
    </td>
    <td width="79%" valign="top"><table border="0" width="100%" cellspacing="1" cellpadding="0">
      <tr>
        <td width="12%" bgcolor="#B7D1F4"><p align="center"><font color="#FF8000">名称</font></td>
        <td width="88%" bgcolor="#FFFFFF"><p align="center">含记事功能的日历</td>
      </tr>
      <tr>
        <td width="12%" bgcolor="#B7D1F4" valign="top"><p align="center"><font color="#FF8000">实例</font></td>
        <td width="88%"><table border="1" width="100%" bordercolor="#B7D1F4" cellspacing="0" cellpadding="0">
          <tr>
            <td width="100%"><p align="center"><script LANGUAGE="JavaScript">
<!--

// Copyright (c) 1996-1997 Tomer Shiran. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.geocities.com/~yehuda/

//
// Cookie functions to store and retrieve cookies
//

// Boolean variable specified if alert should be displayed if cookie exceeds 4KB
var caution = false

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "")
	if (!caution || (name + "=" + escape(value)).length <= 4000)
		document.cookie = curCookie
	else
		if (confirm("Cookie exceeds 4KB and will be cut!"))
			document.cookie = curCookie
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
	var prefix = name + "="
	var cookieStartIndex = document.cookie.indexOf(prefix)
	if (cookieStartIndex == -1)
		return null
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
	if (getCookie(name)) {
		document.cookie = name + "=" + 
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT"
	}
}

// date - any instance of the Date object
// * you should hand all instances of the Date object to this function for "repairs"
// * this function is taken from Chapter 14, "Time and Date in JavaScript", in "Learn Advanced JavaScript Programming"
function fixDate(date) {
	var base = new Date(0)
	var skew = base.getTime()
	if (skew > 0)
		date.setTime(date.getTime() - skew)
}

function initCookie(monthName) {
	// initializes cookie with the following format:
	// ^1^^2^^3^^4^...^30^^31^

	// initialize accumulative variable
	var text = ""
	for (var i = 1; i <= 31; ++i) {
		text += "^" + i + "^"
	}

	var now = new Date()
	fixDate(now)

	// set time to one month (31 days) in the future
	now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 31)

	setCookie(monthName + "Calendar", text, now)
}

function getSpecificReminder(num, monthName) {
	var prefix = "^" + num + "^"
	var totalCookie = getCookie(monthName + "Calendar")
	var startIndex = totalCookie.indexOf(prefix, 0)
	var startData = totalCookie.indexOf("^", startIndex + 1) + 1
	if (num == 31)
		var endData = totalCookie.length
	else
		var endData = totalCookie.indexOf("^", startData)
	
	return totalCookie.substring(startData, endData)
}

function setSpecificReminder(num, monthName, newValue) {
	var prefix = "^" + num + "^"
	var totalCookie = getCookie(monthName + "Calendar")
	var startIndex = totalCookie.indexOf(prefix, 0)
	var startData = totalCookie.indexOf("^", startIndex + 1) + 1
		if (num == 31)
		var endData = totalCookie.length
	else
		var endData = totalCookie.indexOf("^", startData)
	var now = new Date()
	fixDate(now)

	// set time to one month (31 days) in the future
	now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 31)

	setCookie(monthName + "Calendar", totalCookie.substring(0, startData) + newValue + totalCookie.substring(endData, totalCookie.length), now)
}

function getInput(num, monthName) {
	if (!getCookie(monthName + "Calendar")) 
		initCookie(monthName)
	var newValue = prompt("Enter reminder for current date:", getSpecificReminder(num, monthName))
	if (newValue) // user did not cancel
		setSpecificReminder(num, monthName, newValue)
}

function getTime() {
	// initialize time-related variables with current time settings
	var now = new Date()
	var hour = now.getHours()
	var minute = now.getMinutes()
	now = null
	var ampm = "" 

	// validate hour values	and set value of ampm
	if (hour >= 12) {
		hour -= 12
		ampm = "PM"
	} else
		ampm = "AM"
	hour = (hour == 0) ? 12 : hour

⌨️ 快捷键说明

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