Skip to Content
JAVASCRIPT網頁應用程式設計
book

JAVASCRIPT網頁應用程式設計

by Alex MacCaw
January 2013
Intermediate to advanced
332 pages
5h 23m
Chinese
GoTop Information, Inc.
Content preview from JAVASCRIPT網頁應用程式設計
處理檔案
|
109
那麼,究竟有沒有辦法,讓複製 / 貼上功能順利的運作在各種瀏覽器上呢?答案是肯定
的,目前的確有人提供了一些變通的做法。像是 Cappuccino
http://cappuccino.org
),
所採用的做法就是完全不去處理諸如
oncopy
的一系列事件,單純的擷取使用者在鍵盤上
壓下的按鍵。如果它偵測到使用者壓下的按鍵組合是 Command/Ctrl+v,就會聚焦在某
個隱藏的輸入欄位上,並將使用者想貼的資料都填進這個隱藏輸入欄位裡面。這種做法
適用於所有的瀏覽器,但有個明顯的缺點:使用者必須要用鍵盤來進行貼上動作—如果
是用快顯功能表裡的貼上功能,就沒輒了。
讀取檔案內容
取得
File
參照值之後,可以建立
FileReader
的物件實體,將檔案內容讀進記憶體中。
讀取檔案的動作是以非同步方式進行—先為
FileReader
實體設定好一組回叫函式,等到
檔案準備好後,就會呼叫這個回叫函式。
FileReader
提供了四組用來讀取檔案資料內容的函式。該選用哪一組函式來讀取檔案,
端視你希望回傳的資料格式而定。
readAsBinaryString(Blob|File)
file/blob 的資料內容,以二進位字串格式回傳。每個位元組都是以介於 0 255
間的整數來表達。
readAsDataURL(Blob|File)
file/blob 的資料內容,編碼成Data URL
http://en.wikipedia.org/wiki/Data_URI_
scheme
)的格式回傳 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

初めてのJavaScript 第3版 ―ES2015以降の最新ウェブ開発

初めてのJavaScript 第3版 ―ES2015以降の最新ウェブ開発

Ethan Brown, 武舎 広幸, 武舎 るみ
PHP编程:第4版

PHP编程:第4版

Kevin Tatroe, Peter MacIntyre
Strange Code

Strange Code

Ronald T. Kneusel
Perfecting Your Thinking Skills

Perfecting Your Thinking Skills

MIT Sloan Management Review

Publisher Resources

ISBN: 9789862766811