07/27: Javascriptでオブジェクト指向に挑戦2
Category: Web dev
Posted by: hajime osako
function Validator()
{
// Constructor
// Declare Properties
this.regExpPatterns = new Object();
this.errMsgs = new Object();
// Declare Methods
this.validate = function(elm, ptn, msg)
{
var _str = null;
if(!ptn && elm.name && _parent.regExpPatterns[elm.name])
{
ptn = this.regExpPatterns[elm.name];
}
...
}
this.setAlertErr = function(bool)
{
this.alertErr = bool;
}
this.getAlertErr = function()
{
return this.alertErr;
}
}
OR
var Validator = new Function();
Validator.prototype.field1 = XXXXXX;
Validator.prototype.method1 = function (param1, param2)
{
[snip]
}