易截截图软件、单文件、免安装、纯绿色、仅160KB

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/


相关文档:

JavaScript验证上传文件格式及大小

在上传操作中,经常会遇到要求指定上传文件的格式,下面的实例是在客户端通过JavaScript验证上传图片格式为jpg/gif/png
<html>
<head>
<mce:script language="JavaScript" type="text/JavaScript"><!--

var img=null;
function checkPic(picForm){
var location=picForm.pic.v ......

利用javaScript动态增加表格行,删除表格行

示例:
- - - - - - - - - - - -
<body>
<input type="button" value="create" onclick="createTr();">
<table border='1' id="t" >
</table>
<input type="button" value="提交" onclick="okss();" />
</body>
<script type="text/javascript">
  &nbs ......

Javascript日期格式 正则 yyyy MM dd

reg = /^((((((0[48])|([13579][26])|([2468][048]))00)|([0-9][0-9]((0[48])|([13579][26])|([2468][048]))))-02-29)|(((000[1-9])|(00[1-9][0-9])|(0[1-9][0-9][0-9])|([1-9][0-9][0-9][0-9]))-((((0[13578])|(1[02]))-31)|(((0[1,3-9])|(1[0-2]))-(29|30))|(((0[1-9])|(1[0-2]))-((0[1-9])|(1[0-9])|(2[0-8]))))))$/i; ......

JavaScript 表格对象和操作

一。取表格对象
var getTable= document.getElementById("tabHeTong");
 
二。插入行
var oTR = getTable.insertRow();//新增一行
 
三。某行加入列
var oTDa = oTR.insertCell();//新增一列
var oTDb = oTR.insertCell();//新增二列
var oTDc = oTR.insertCell();//新增三列
四。删除行:
getTable. ......

107条Javascript的常用语句

1.         document.write( " "); 输出语句
2.JS中的注释为//
3.传统的HTML文档顺序是:document- >html- >(head,body)
4.一个浏览器窗口中的DOM顺序是:window- >(navigator,screen,history,location,document)
5.得到表单中元素的名称和值:document.getElementById( "表单 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号