foobar.htm
来自「ajax.net,一个应用AJAX.NET框架的例子」· HTM 代码 · 共 97 行
HTM
97 行
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
</head>
<body>
<script>
Foo = function(p_name)
{
var me = this;
var _type = null;
me.name = p_name;
me.age = 0;
me.id = 0;
me._abc = "abc";
me.getProperty = function(p_propertyName)
{
return me[p_propertyName];
}
me.setProperty = function(p_propertyName, p_value)
{
me[p_propertyName] = p_value;
}
me.call = function()
{
_call();
}
me.getType = function()
{
if (_type == null)
{
_type = Foo.defaultName;
}
return _type;
}
me.setType = function(p_value)
{
_type = p_value;
}
function _call()
{
alert("This is " + me.name + ".");
}
return me;
}
Foo.defaultName = "Foo";
Foo._singleton = null;
Foo. getSingleton = function()
{
if (Foo._singleton == null)
{
Foo._singleton = new Foo("foo");
}
return Foo._singleton;
}
function Bar(p_name)
{
var me = new Foo(p_name);
me.call = function()
{
alert("That is " + me.name + ".");
}
me.toString = function()
{
return me.name + ", " + me.age;
}
return me;
}
</script>
<script>
var foo = Foo.getSingleton();
var bar = new Bar("Bar");
alert(bar);
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?