Skip to Content
MOBILE HTML5學習手冊
book

MOBILE HTML5學習手冊

by Estelle Weyl
June 2014
Intermediate to advanced
488 pages
9h 56m
Chinese
GoTop Information, Inc.
Content preview from MOBILE HTML5學習手冊
92
|
第四章
雖然你可以在 email URL 加入
maxlength
,但我通常會建議不要使用它,除非有讓人
信服的理由。既然所有瀏覽器都支援任何 email URL 長度,為什麼要讓使用者介面判
斷某個 email 地址或 URL 過長?除非基於安全性的考量,以及有實際字元的限制,否則
為了有良好的使用者體驗,你應該仔細思考添加這個屬性的後果。即使 Twitter 也不會
使用它,因為使用者有時想要輸入 140 個字元以上,接著再刪去一些單字或字元,讓它
們可以小於 140 個字元的限制。
size 屬性
size
屬性是另一個舊屬性。之前它有兩種功能:定義表單控制項(如
<select>
)要顯示
的選項,以及定義表單控制項顯示的字元數目來控制寬度。
<input>
元素的
size
屬性應
該被汰除,改用 CSS 來指定表單的版面配置。
事實上
size
屬性曾經被汰除一段時間,但又被放回 HTML5 草案規格。
size
屬性不會影
響可輸入的字元(應使用
maxlength
),或可選擇的選項(應使用
multiple
)。
form 屬性
HTML5 中,表單控制項不一定要被嵌套在表單裡面,這是新的功能。新的
form
屬性
可以讓一個表單元素與任何網頁中的表單結合。它們也可以被嵌套在一個表單中,但由
另一個表單提交。
表單控制項可以有一個
form
屬性及
form
id
,讓表單控制項可以連結它。透過這種方
式,你可以將表單控制項放在網頁的任何位置,包括負責提交它的表單的外面。
這有一點複雜,所以我們來看一個範例:
<form ...
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網頁應用程式設計

JAVASCRIPT網頁應用程式設計

Alex MacCaw

Publisher Resources

ISBN: 9789863471240