Skip to Content
MOBILE WEB程式設計--第二版
book

MOBILE WEB程式設計--第二版

by Maximiliano Firtman
December 2013
Intermediate to advanced
752 pages
16h
Chinese
GoTop Information, Inc.
Content preview from MOBILE WEB程式設計--第二版
450
|
第十二章
WHATWG HTML 規格(
http://whatwg.org/C
)包含
dialog
元素的定義,
可與 API 一起用來開啟彈出視窗與自訂的對話方塊。我們將來可能會看到
這項元素的實作,但目前它仍未出現在行動瀏覽器的世界中。
有些瀏覽器會完全地忽略
window.close
呼叫,但有一些(如 iOS Safari)會關閉目前的
視窗並將使用者帶回視窗清單(在 iPhone iPod 設備上)。
較佳的替代方案是在連結中使用
target="_blank"
。在行動設備上,這種做
法產生的結果與
window.open
呼叫一樣,而且它可在所有瀏覽器上動作。
如果瀏覽器不支援多重視窗,它會直接取代原本的那個。
聚焦與捲動管理
你可以使用每一個 DOM 元素的
focus
函式來聚焦可點擊元素(例如表單輸入、連結,
或按鈕)。它最實用的地方在於表單輸入控制項。它的行為會依不同的行動瀏覽器而
異,在一些觸控設備上,聚焦於文字方塊會自動打開螢幕鍵盤,在一些游標式瀏覽器
上,它會將游標移往該元素。
如果使用者正在瀏覽表單式文件,例如搜尋網頁或「聯絡我們」網頁,較
易用的做法是自動聚焦於第一個文字輸入項目,如此可減少使用者在網頁
的導覽次數。
在一些設備上,全域的
window
物件有一個
scrollTo()
函式,它使用兩個參數:
xPosition
yPosition
來指定捲動目的的左上角位置。在一些設備上(例如 iPhone),
使用
scrollTo()
可模擬使用者的捲動動作並隱藏瀏覽器的工具列,如同使用者正在以他 ...
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

成為卓越程式設計師的38項必修法則

成為卓越程式設計師的38項必修法則

Pete Goodliffe
精實企業|高績效組織如何達成創新規模化

精實企業|高績效組織如何達成創新規模化

Jez Humble, Joanne Molesky, Barry O'Reilly

Publisher Resources

ISBN: 9789862769522