JavaScript 时间加减 改变
JavaScript 时间加减:
<HTML>
<BODY>
<script type="text/javascript">
var time = new Date("04/30/2010");
document.write(time);
document.write("<br>");
//plus two days
var haomiao = time.getTime() +2*24*60*60*1000;
var plustime = new Date(time.setTime(haomiao));
document.write(plustime);
</script>
</BODY>
</HTML>
JavaScript 时间改变:
<HTML>
<HEAD>
</HEAD>
<BODY>
<script type="text/javascript">
//now time
var nowtime = new Date();
document.write(nowtime);
document.write("<br>");
//change time
var changetime = new Date(nowtime.setYear("1987"));
changetime = new Date(nowtime.setMonth("7"));
changetime = new Date(nowtime.setDate("16"));
document.write(changetime);
document.write("<br>");
</script>
</BODY>
</HTML>
相关文档:
click() 对象.click() 使对象被点击。
closed 对象.closed 对象窗口是否已关闭true/false
clearTimeout(对象) 清除已设置的setTimeout对象
clearInterval(对象) 清除已设置的setInterval对象
confirm("提示信息") 弹出确认框,确定返回true取消返回false
cursor:样式 更改鼠标样式 hand crosshair text wait help defa ......
<html>
<head>
<script language="javascript">
function overlay() {
xyz = document.getElementById("overlay");
&n ......
<html xmlns="http://www.w3.org/1999/xhtml" >
<head >
<title></title>
</head>
<body>
<form id="form1">
<div>
& ......
JavaScript获取DOM节点元素
在Web应用程序特别是Web2.0程序开发中,经常要获取页面中某个元素,然后更新该元素的样式、内容等。如何获取要更新的元素,是首先要解决的问题。令人欣慰的是,使用JavaScript获取节点的方法有很多种,这里简单做一下总结:
通过顶层document节点获取:
1. document.getElement
......
当需要在网页中显示时间时可以用到下面这段代码:
<SCRIPT language=JavaScript type=text/JavaScript>
var day="";
var month="";
var ampm="";
var ampmhour="";
var myweekday="";
var year="";
mydate=new Date();
myweekday=mydate.getDay();
mymonth=mydate.getMonth()+1;
myday= mydate.getDate(); ......