<html>
<head>

<script language="javascript">

function init(){


return;


/* 通常のオブジェクトの作成 */
var SuperClass=function(){this.initialize();};

SuperClass.prototype = {
 initialize: function() {
   alert("call Insertion.prototype.initialize");
 },
 DoTest: function() {
   alert("call Insertion.prototype.initialize");
 },
 DoTest1: function() {
   alert("call Insertion.prototype.initialize");
 }


};

var T = new SuperClass();

return;


/* ユティリティ関数の作り方その1 */
var Util={};
/* オブジェクトリテラル */
Util.T = {
doTest1:function(){alert("t1");},
doTest2:function(){alert("t2");}
};
Util.T.doTest1();
Util.T.doTest2();

return ;

/* ユティリティ関数の作り方その2 */

var Util={};

util.Dom = function() {
  return {
doTest1:function(){alert("t1");},
doTest2:function(){alert("t2");}
}
}();

Dom.doTest1();



/* 関数リテラルのパターン */
var TEST = (function(x){return x*x;})();

var a =function(){
alert("hoge");
};

a();

/* hoge1が出力される */
var a=function(){alert("hoge1");}();

/* hoge1が出力される */
var a=(function(){alert("hoge1");})();


/* エラーが出る */
(function(){
alert("hoge2");
})();

/* hoge2が出力される */
(function(){
alert("hoge2");
})();


}

</script>
</head>

<body onload=init()>
</body>
</html>
最終更新:2006年08月06日 16:54