2014-05-01から1ヶ月間の記事一覧

モニターのサイズの取得

モニターのウインドウサイズを取得 <script type="text/javascript"> function getMonitorSize(){ var monitorsize = { width: window.screen.width, height: window.screen.height, availWidth: window.screen.availWidth, availHeight: window.screen.availHeight } return monitorsize; }…

setIntervalとsetTimeoutの違い

setTimeout var i = 0; function show(){ console.log(i++); setTimeout (function(){ show(); },1000); } show(); setInterval var i = 0; function show(){ console.log(i++); } setInterval (function(){ show(); },1000); show();

グローバル変数とローカル変数の範囲

グローバル変数とローカル変数の範囲 var scope = "global"; function f(){ console.log(scope); // undefinedと表示 var scope = "local"; console.log(scope); //localと表示} console.log(scope); //globalと表示f(); 関数内で同じ名前の変数が宣言された…