JavaScript prototype 属性
定义与用法
The prototype property allows you to add properties and methods to an
object.
prototype属性允许你向一个对象添加属性和方法
Syntax
语法
object.prototype.name=value
Example 1
实例
In this example we will show how to use the prototype property to add a
property to an object:
在下面的例子中,我们将演示如何用prototype属性来向一个对象增加一个属性:
<script type="text/javascript">
function employee(name,jobtitle,born)
{
this.name=name
this.jobtitle=jobtitle
this.born=born
}
var fred=new employee("Fred Flintstone","Caveman",1970)
employee.prototype.salary=null
fred.salary=20000
document.write(fred.salary)
</script>
The output of the code above will be:
输出结果为:
20000
相关文档:
javascript:void(0)
刚开始都不知道是啥意思
其实就是一个死链接,什么事情都不做。
<a id="link_${user.account}" href="javascript:void(0);" onclick="changSubmit();" style="cursor:pointer;height:25px;width:60px;margin-top:10px;">发送email</a>
这句 ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>vForm表单验证程 ......
var myDate = new Date();
myDate.getYear(); //获取当前年份(2位)
myDate.getFullYear(); //获取完整的年份(4位,1970-????)
myDate.getMonth(); //获取当前月份(0-11,0代表1月)
myDate.getDate();   ......
Javascript刷新页面的几种方法:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7& ......