aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/filereader/onload/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/filereader/onload/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/api/filereader/onload/index.html')
-rw-r--r--files/ja/web/api/filereader/onload/index.html29
1 files changed, 29 insertions, 0 deletions
diff --git a/files/ja/web/api/filereader/onload/index.html b/files/ja/web/api/filereader/onload/index.html
new file mode 100644
index 0000000000..cee0e907f9
--- /dev/null
+++ b/files/ja/web/api/filereader/onload/index.html
@@ -0,0 +1,29 @@
+---
+title: FileReader.onload
+slug: Web/API/FileReader/onload
+tags:
+ - Event Handler
+ - File
+ - FileReader
+ - Property
+ - Reference
+translation_of: Web/API/FileReader/onload
+---
+<p>{{APIRef}}</p>
+
+<p><strong><code>FileReader.onload</code></strong> プロパティは、<a href="/ja/docs/Web/API/FileReader/readAsArrayBuffer">readAsArrayBuffer</a> や <a href="/ja/docs/Web/API/FileReader/readAsBinaryString">readAsBinaryString</a>、 <a href="/ja/docs/Web/API/FileReader/readAsDataURL">readAsDataURL</a>、<a href="/ja/docs/Web/API/FileReader/readAsText">readAsText</a> でのコンテンツ読み込みが完了して、利用可能になると発火する {{event('load')}} イベント時に実行されるイベントハンドラを含みます。</p>
+
+<h2 id="例">例</h2>
+
+<pre class="brush:js; line-numbers language-js"><code class="language-js">// &lt;input type="file" onchange="onChange(event)"&gt; からのコールバック
+function onChange(event) {
+ var file = event.target.files[0];
+ var reader = new FileReader();
+ reader.onload = function(event) {
+ // ファイルのテキストがここにプリントされる
+ console.log(event.target.result)
+ };
+
+ reader.readAsText(file);
+}
+</code></pre>