JavaScript 相关 —— 取当前日期
var myDate = new Date();
myDate.getYear(); //获取当前年份(2位)
myDate.getFullYear(); //获取完整的年份(4位,1970-????)
myDate.getMonth(); //获取当前月份(0-11,0代表1月)
myDate.getDate(); //获取当前日(1-31)
myDate.getDay(); //获取当前星期X(0-6,0代表星期天)
myDate.getTime(); //获取当前时间(从1970.1.1开始的毫秒数)
myDate.getHours(); //获取当前小时数(0-23)
myDate.getMinutes(); //获取当前分钟数(0-59)
myDate.getSeconds(); //获取当前秒数(0-59)
myDate.getMilliseconds(); //获取当前毫秒数(0-999)
myDate.toLocaleDateString(); //获取当前日期
myDate.toLocaleTimeString(); //获取当前时间
myDate.toLocaleString( ); //获取日期与时间
DateTime.Now.ToString("yyyy年MM月dd日 ddd",System.Globalization.CultureInfo.CreateSpecificCulture("zh-CN")) //获取当前的日期与星期; 格式:2009年07月09日 星期四
相关文档:
Several programming languages implement a sprintf function, to output a formatted string. It originated from the C programming language, printf function. Its a string manipulation function.
This is limited sprintf Javascript implementation. Function returns a string formatted by the usual printf co ......
Javascript的继承可以通过call、apply、prototype实现。
1、call:在子类中,用父类.call(this,arg0,arg1...)可以继承父类。注意call的位置,尽量在子类的第一行(js按顺序执行,放在后面可能对子类的其他属性、方法有影响。比如子类和父类有相同名字的方法,后面的覆盖前面的)。
<html>
<head>
<t ......
按钮式:
<INPUT name="pclog" type="button" value="GO" onClick="location.href='url'">
直接跳转式:
<script>window.location.href='url';</script>
<SCRIPT LANGUAGE="javascript">
<!--
window.open
('page.html' ......
下面都是个人理解以及查找的网上的资料,如有不对的地方请指正
This
this 始终指向调用它的对象 ,都没有对象调用时就指向window
另外就是this一般都是在function中,当不在function中的时候 一定是指向window的.
var a ='a';
alert(this.a); //出来的是a
alert(this.b); //undefined 因为还没定义 ......
1、function vv()
{
if(event.button==2)
{
alert('防止服务器负担过大,右键功能被屏蔽!')
......