拡張子:txtvbswsfjsphpjavahtmlutf8sjis <!doctype html> <html lang="en"> <head> <title>サンプル</title> <meta charset="utf-8"> <style> </style> </head> <body> <script> var R101 = {}; R101.Class = function(){ this.version = "1.01"; this.colors = []; this.flg = false; }; R101.Class.prototype = { constructor: R101.Class, method1: function() { alert("method1:"+this.version); }, method2: function() { alert("method2:"+(this.data||"未定義です")); }, method3: function() { alert("method3:"+this.flg); this.data = {}; } } var obj = new R101.Class(); </script> <input type="button" value="method1" onclick="obj.method1();" /> <input type="button" value="method2" onclick="obj.method2();" /> <input type="button" value="method3" onclick="obj.method3();" /> </body> </html>
<!doctype html> <html lang="en"> <head> <title>サンプル</title> <meta charset="utf-8"> <style> </style> </head> <body> <script> var R101 = {}; R101.Class = function(){ this.version = "1.01"; this.colors = []; this.flg = false; }; R101.Class.prototype = { constructor: R101.Class, method1: function() { alert("method1:"+this.version); }, method2: function() { alert("method2:"+(this.data||"未定義です")); }, method3: function() { alert("method3:"+this.flg); this.data = {}; } } var obj = new R101.Class(); </script> <input type="button" value="method1" onclick="obj.method1();" /> <input type="button" value="method2" onclick="obj.method2();" /> <input type="button" value="method3" onclick="obj.method3();" /> </body> </html>