javascript日期对象
1.日期对象的构造
1.1当前日期
var now = new Date();
1.2特定日期
var someDate = new Date(yyyy,mm,dd);
注:月应该是从0开始计数的.
2. 日期函数的使用可以参照下面的链接. http://www.w3school.com.cn/js/jsref_obj_date.asp
为了防止自己忘记,再补充一个函数.
求某月有多少天的时候,可以参照下面的方法.
var someDate = new Date(yyyy, mm, 0); //这样是第mm个月的最后一天
var days = someDate.getDate();
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
尽管那需要用长串的、沉闷的不同分支代码来应付不同浏览器的日子已经过去,偶尔还是有必要做一些简单的区分和目标检测来确保某块代码能在用户的机器上正常运行。在这篇文章中,作者介绍了7个在IE和firefox中不同的JavaScript句法。
1. CSS "float" 值
访问一个给定CSS 值的最基本句法 ......
打开一个 js 文件,编辑完成保存时,突然提醒下面的错误:
Save could not be completed.
Reason:
Some characters cannot be mapped using “ISO-8859-1″ character encoding. Either change the encoding or remove the characters which are not supported by the “ISO-8859-1″ character ......
1、无提示关闭窗口
<input type="button" onClick="window.opener = '';window.close();" value="IE6最简单的无提示关闭窗口" >
2、防止被人iframe
if (top.location != self.location)
{
top.location.href="http://www.34do.net";
}
3、判断一个对象存在不存在
document.all("a")==null(不存在)
......
<html>
<head></head>
<script>
function ShowMenu(bMenu) {
document.all.idFinder.style.display = (bMenu) ? "none" : "block"
document.all.idMenu.style.display = (bMenu) ? "block" : "none"
idML.className = (bMenu) ? "cOn" : "cOff"
idRL.className = (bMenu) ? "cOff" : "cOn" ......