Web Programming with HTML, XHTML, and CSS Second Edition- P5
Thông tin tài liệu:
Nội dung trích xuất từ tài liệu:
Web Programming with HTML, XHTML, and CSS Second Edition- P5 Chapter 5: Forms Figure 5-20Str ucturing Your Forms with and Elements Large forms can be confusing for users, so it’s good practice to group together related form controls. The and elements do exactly this — help you group controls. Both elements were introduced in IE 4 and Netscape 6; however, older browsers will just ignore these elements, so you are safe to include them in all your forms. ❑ The element creates a border around the group of form controls to show that they are related. ❑ The element allows you to specify a caption for the element, which acts as a title for the group of form controls. When used, the element should always be the first child of the element. In the following example, you can see how a form has been divided into four sections: contact information, competition question, tiebreaker question, and enter the competition (ch05_eg17.html). Contact Information First name: Last name: E-mail: Competition Question How tall is the Eiffel Tower in Paris, France? 584ft 784ft 984ft 1184ft Tiebreaker Question 171Chapter 5: Forms In 25 words or less, say why you would like to win $10,000: Enter competition You can see how the elements create borders around the groups of form controls, and how the elements are used to title the groups of controls. Remember that the element must be the first child of the element when it is used. See Figure 5-21. Figure 5-21 The element can take the following attributes: ❑ All the universal attributes ❑ The basic event attributes Note that if you use a table to format your form, the element must appear inside the element. If a resides within a table that is used to format the page, then the entire fieldset must reside within the same cell.172 Chapter 5: Forms The element can take the following attributes: ❑ accesskey, which you will learn about in the next section ❑ align (which is deprecated — you should use CSS positioning instead) ❑ All of the universal attributes ❑ UI event attributesFocus When a web page featuring several links or several form controls loads, you might have noticed that you are able to use your Tab key to move between those elements (or Shift+Tab to move backward through elements). As you move between them, the web browser tends to add some form of border or highlight- ing to that element (be it a link or a form control). This is known as focus. From what you have learned already about XHTML, you know that not every element in the document receives this focus. In fact, it is only the elements that a user can interact with, such as links and form con- trols, that can receive focus. Indeed, if a user is expected to interact with an element, that element must be able to receive focus. An element can gain focus in three ways: ❑ An element can be selected using a pointing device such as a mouse or trackball. ❑ The elements can be navigated between using the keyboard — often using the Tab key (or Shift+Tab to move backward through elements). The elements in some documents can be given a fixed tabbing order, indicating the order in which elements gain focus. ❑ You can use a system such as a keyboard shortcut known as an access key to select a particular ele- ment. For example, on a PC you would likely press the Alt key plus an access key (such as Alt+E), whereas on a Mac you would press the Control key with an access key (such as Control+E).Tabbing Order If you want to control the order in which elements can gain focus, you can use the tabindex attribute to give that element a number between 0 and 32767, which forms part of the tabbing order. Every time the user presses the Tab key, the focus moves to the element with the next highest tabbing order (and again, Shift+Tab moves focus in reverse order). The following elements can carry a tabindex attribute: The tabindex attribute was first supported in Netscape 6 and IE 4, but older browsers just ignore this attribute, so it is safe to use it in all documents. After a user has tabbed through all elements in a document that can gai ...
Tìm kiếm theo từ khóa liên quan:
phương pháp lập trình lập trình web với html ngôn ngữ lập trình html lập trình xhtmlGợi ý tài liệu liên quan:
-
Giáo trình Lập trình logic trong prolog: Phần 1
114 trang 194 0 0 -
Giáo trình Lập trình C căn bản: Phần 1
64 trang 170 0 0 -
Giáo trình Lập trình C căn bản
135 trang 170 0 0 -
14 trang 134 0 0
-
Bài giảng Phương pháp lập trình: Chương 9 - GV. Từ Thị Xuân Hiền
36 trang 112 0 0 -
Giáo trình lập trình hướng đối tượng - Lê Thị Mỹ Hạnh ĐH Đà Nẵng
165 trang 112 0 0 -
Giáo trình về môn Lập trình C căn bản
131 trang 50 0 0 -
Bài giảng Lập trình hướng đối tượng (dùng JAVA): Chương 1 - Trần Minh Thái
40 trang 41 0 0 -
PHP: The Good Parts: Delivering the Best of PHP- P5
20 trang 36 0 0 -
Bài giảng Lập trình căn bản - Trường CĐ Công nghệ và Nông Lâm Nam Bộ
219 trang 28 0 0 -
Giáo trình Lập trình hướng đối tượng C++
197 trang 28 0 0 -
68 trang 27 0 0
-
Bài giảng Phương pháp lập trình - Chương 4: Mảng
9 trang 26 0 0 -
50 trang 25 0 0
-
50 trang 25 0 0
-
Bài giảng Phương pháp lập trình: Bài 8 - TS. Ngô Hữu Dũng
43 trang 25 0 0 -
50 trang 24 0 0
-
Bài giảng Lập trình hướng đối tượng: Chương 1 - Trần Minh Thái
40 trang 24 0 0 -
Bài giảng lập trình Web - Ts.Vũ Đức Lung - Chương 6
24 trang 24 0 0 -
Bài giảng lập trình Web - Ts.Vũ Đức Lung - Chương 5
45 trang 24 0 0