「javascript」の編集履歴(バックアップ)一覧はこちら

javascript」(2006/08/06 (日) 16:54:11) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

<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 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>

表示オプション

横に並べて表示:
変化行の前後のみ表示: