2013-01-31から1日間の記事一覧

指定時間後に処理を実行

デジタル時計の作成 タイマー機能/li>一定時間ごとに処理を繰り返すwindowオブジェクトの「setTimeoutメソッド」を使用 ソースコード【 HTML 】 <html lang="ja"> <head> <meta charset="UTF-8"> <title>タイマー</title> <style> input { width: 90px; font-size: 66px; font-family: monospace;/* [ monospace ]モノスペース </meta></head></html>…

指定時間後に処理を実行02

DOMによる記述 ソースコード【 HTML 】 <html lang="ja"> <head> <meta charset="UTF-8"> <title>デジタル時計</title> <style> #clock { width: 450px; background-color: #000; color: #fff; text-align: center; border: 10px solid #666; font-size: 90px; font-weight: bold; padding: 10px 20px; } </style> <script> va…</meta></head></html>

指定時間後に処理を実行まとめ

指定時間後に処理を実行 タイマーを使うと、一定周期で処理を繰り返すことができる setTimeoutメソッド:タイマーを開始する clearTimeoutメソッド:タイマーを停止する

ユーザー定義オブジェクト

ユーザー定義オブジェクトとは ユーザーがオリジナルのオブジェクトを ソースコード【 HTML 】 <html lang="ja"> <head> <meta charset="UTF-8"> <title>ユーザー定義オブジェクト</title> <script> function Person(name, height){ this.name = name; this.height = height; } </script> </head> <body> <script> var friends = new Array(3); friends[0] = ne</body></html>…

ユーザー定義オブジェクトまとめ

ユーザー定義オブジェクト コンストラクタは、functionキーワードで定義する li>コンストラクタ内でプロパティに値を設定するには、「this . プロパティ名 = 値」と記述する

prototypeプロパティ

オブジェクトにメソッドを追加する prototypeプロパティを使用してオブジェクトにメソッドを定義する ソースコード【 HTML 】 <html lang="ja"> <head> <meta charset="UTF-8"> <title>prototypeによるメソッドの追加</title> <script> function Person(name, height){ this.name = name; this.height = height; } function calc</meta></head></html>…

prototypeプロパティまとめ

prototypeプロパティ ユーザー定義オブジェクトには、メソッドを追加できる メソッドを追加するには、prototypeプロパティに関数を代入する