惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
Y
Y Combinator Blog
博客园 - 【当耐特】
V
Visual Studio Blog
GbyAI
GbyAI
V
V2EX
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net
Hugging Face - Blog
Hugging Face - Blog
A
About on SuperTechFans
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
量子位
MongoDB | Blog
MongoDB | Blog
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件

博客园 - 小小点

使用 C# 将数字转换成大写人民币 发个自己写的分页类 计划+日程表+严格执行 今天开始做事 享受过程 明天失踪一天 加班加班 不能连接MySQL数据库的解决办法 解决安装 MSSQL 提示有挂起的安装问题 [转载] ASP中无组件上传文件 PHP读MYSQL中文乱码的解决方法 自己定义的模仿窗体标题栏的控件 意料之中 DHTML文件访问本地数据库[转] 在b/s开发中经常用到的javaScript技术 [转贴] 关机脚本(转载) 离开... 在MSSQL中利用存储过程进行分页查询 压缩MSSQL数据库日志文件大小
JS模拟类实现
小小点 · 2006-12-29 · via 博客园 - 小小点

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> JS模拟类实现 </title>
<meta name="Author" content="HuangQing">
</head>

<body>
<script language="JavaScript">
<!--
/*
 * Javascript 没有真正的类定义,一般都是用变量来模拟实现的。
 */

// 模拟类定义
var clsTest = function Test(){
 var name,age;
 this.setName = function (str){ this.name = str; }
 this.getName = function (){ return this.name;}
}


// 模拟实例
var example = new clsTest();
example.setName(window.prompt("提示操作:","在此输入您的大名"));
alert("您叫: " + example.getName());
alert("数据类型检测: " + typeof(example));

//-->
</script>
</body>
</html>