📄 foobar.htm
字号:
<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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -