JavaScript constructor属性
Definition and Usage
定义与用法The constructor property is a reference to the function that created an object.
constructor属性是所建立对象的函数参考Syntax
语法object.constructor
Example 1
举例
In this example we will show how to use the constructor property:
在这个举例中我们将展示如何使用constructor属性:
<script type="text/javascript">
var test=new Array()
if (test.constructor==Array)
{document.write("This is an Array")}
if (test.constructor==Boolean)
{document.write("This is a Boolean")}
if (test.constructor==Date)
{document.write("This is a Date")}
if (test.constructor==String)
{document.write("This is a String")}
</script>
The output of the code above will be:
输出结果为:
This is an Array
Example 2
举例2
In this example we will show how to use the constructor property:
在这个举例中我们将展示如何使用constructor属性:
<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)
document.write(fred.constructor)
</script>
The output of the code above will be:
输出结果为:
function employee(name, jobtitle, born)
{this.name = name; this.jobtitle = jobtitle; this.born = born;}
Try-It-Yourself Demos
尝试与演示
constructor - example 1
In this example we will show how to use the constructor property.
在这个举例中我们将展示如何使用constructor属性
constructor - example 2
In this example we will show how to use the constructor property.
在这个举例中我们将展示如何使用constructor属性
http://www.w3pop.com/learn/view/doc/jsref_constructor_array/
相关文档:
<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false" onbeforecopy="return false" onmouseup=document.selection.empty() oncopy=document.selection.empty() onselect=document.selection.empty()></body>
讲上面红色显示的插入到网页中就可以实现鼠标右击无效
......
删除行
<script>
function del(obj)
{
obj.parentNode.parentNode.removeNode(true);
}
</script>
<body& ......
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="return f ......
一、介绍与Flash动画控制有关的javascript函数:
函数名 使用 &n ......
一。取表格对象
var getTable= document.getElementById("tabHeTong");
二。插入行
var oTR = getTable.insertRow();//新增一行
三。某行加入列
var oTDa = oTR.insertCell();//新增一列
var oTDb = oTR.insertCell();//新增二列
var oTDc = oTR.insertCell();//新增三列
四。删除行:
getTable. ......