HTML & CSS: The Complete Reference- P7

Chia sẻ: Thanh Cong | Ngày: | Loại File: PDF | Số trang:50

0
56
lượt xem
11
download

HTML & CSS: The Complete Reference- P7

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Tham khảo tài liệu 'html & css: the complete reference- p7', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả

Chủ đề:
Lưu

Nội dung Text: HTML & CSS: The Complete Reference- P7

  1. 276 Part I: Core Markup (Image) This element indicates a media object to be included in an (X)HTML document. Usually, the object is a bitmap graphic image, but some implementations support movies, vector formats, and animations. Standard Syntax Other Common Attributes align="absbottom | absmiddle | baseline | texttop" lowsrc="URL of low-resolution image" tabindex="number" Attributes Introduced by HTML5 accesskey="spaced list of accelerator key(s)" contenteditable="true | false | inherit" contextmenu="id of menu" data-X="user-defined data" draggable="true | false | auto" hidden="hidden" itemid="microdata id in URL format" itemprop="microdata value" itemref="space-separated list of IDs that may contain microdata" itemscope="itemscope" itemtype="microdata type in URL format" spellcheck="true | false" tabindex="number" Attributes Defined by Internet Explorer accesskey="key" (5.5) datafld="name of column supplying bound data" (4) datasrc="id of data source object supplying data" (4)
  2. Chapter 3: HTML and XHTML Element Reference 277 dynsrc="URL of movie" (4) galleryimg="yes | no | true | false" (6) hidefocus="true | false" (5.5) language="javascript | jscript | vbs | vbscript" (4) PART I loop="infinite | number" (4) start="fileopen | mouseover" (5) unselectable="on | off" (5.5) HTML 4 Event Attributes onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup HTML5 Event Attributes onabort, onblur, oncanplay, oncanplaythrough, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, onformchange, onforminput, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreadystatechange, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, onvolumechange, onwaiting Events Defined by Internet Explorer onabort, onactivate, onafterupdate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onbeforeupdate, onblur, onclick, oncontextmenu, oncontrolselect, oncopy, oncut, ondblclick, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerrorupdate, onfilterchange, onfocus, onfocusin, onfocusout, onhelp, onload, onlosecapture, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror Element-Specific Attributes align This attribute controls the horizontal alignment of the image with respect to the page. The default value is left. Many browsers, such as Netscape and Internet Explorer implementations, support the absbottom, absmiddle, baseline, and texttop values. This attribute is deprecated under strict variants of (X)HTML as well as HTML5. alt This attribute contains a string to be displayed instead of the image for browsers that cannot display images. border This attribute indicates the width, in pixels, of the border surrounding the image. HTML5 suggests the element should not be used other than to set a value of 0, as CSS should be used instead.
  3. 278 Part I: Core Markup dynsrc In the Microsoft implementation, this attribute indicates the URL of a movie file and is used instead of the src attribute. Common formats used here are .avi (Audio-Visual Interleaved), .mov (QuickTime), and .mpg and .mpeg (Motion Picture Experts Group). Be careful, because support of this attribute beyond Internet Explorer 6 is suspect and security settings may restrict it. galleryimg This Microsoft attribute is used to control whether the gallery image menu should appear when the mouse pointer hovers over an image. The default value is true or yes. A value of no or false suppresses the menu. A meta tag like can be used to suppress the image toolbar document-wide. This attribute is rendered obsolete in later versions of Internet Explorer (7+). ismap This attribute indicates that the image is a server-side image map. User mouse actions over the image are sent to the server for processing. longdesc This attribute specifies the URL of a document that contains a long description of the image. This attribute is used as a complement to the alt attribute. loop In the Microsoft implementation, this attribute is used with the dynsrc attribute to cause a movie to loop. Its value is either a numeric loop count or the keyword infinite. Later versions of Internet Explorer suggest using –1 to indicate infinite. Since it is related to dynsrc, the use of to play movies does not work past Internet Explorer 6 unless security settings are modified. lowsrc This nonstandard attribute, supported in most browsers, contains the URL of an image to be initially loaded. Typically, the lowsrc image is a low-resolution or black-and- white image that provides a quick preview of the image to follow. Once the primary image is loaded, it replaces the lowsrc image. name This common attribute is used to bind a name to the image. Older browsers understand the name field, and, in conjunction with scripting languages, it is possible to manipulate images by their defined names to create effects such as “rollover” buttons. Under modern versions of HTML and XHTML, the id attribute should be used as an element identifier for scripting and style application. The name attribute can still be used for backward compatibility. src This attribute indicates the URL of an image file to be displayed. Most browsers will display .gif, .jpeg, and .png files directly. Older formats like .bmp, .xpm (X Bitmap), and .xpm (X Pixelmap) are also commonly supported, though their use is never recommended. Some modern browsers may support .svg (Scalable Vector Graphics) files as well with the img element. start In the Microsoft implementation, this attribute is used with the dynsrc attribute to indicate when a movie should play. The default value, if no value is specified, is to play the video as soon as it has finished loading. This can be explicitly set with a value of fileopen. Alternatively, a value of mouseover can be set to play the move once the user has moved their mouse over the video. This, like other dynsrc features, may not work past Internet Explorer 6 browsers because of security changes.
  4. Chapter 3: HTML and XHTML Element Reference 279 usemap This attribute makes the image support client-side image mapping. Its argument is a URL specifying the map file, which associates image regions with hyperlinks. The URL is generally a fragment identifier that references a location in the current document rather PART I than a remote resource. Examples Compatibility HTML 2, 3.2, 4, 4.01, 5 Firefox 1+, Internet Explorer 2+, XHTML 1.0, 1.1, Basic Netscape 1+, Opera 2.1+, Safari 1+ Notes • Typically, when you use the usemap attribute, the URL is a fragment, such as #map1, rather than a full URL. Some browsers do not support external client-side map files. HTML5 makes this statement more strongly than in other specifications. • Under the strict HTML and XHTML definitions, the tag does not support align, border, height, hspace, vspace, and width. The functionality of these attributes should be possible using style sheet rules. • Whereas the HTML 4 specification reserves data-binding attributes such as datafld or datasrc for many elements, they are not specified for ; however, Internet Explorer provides support for these attributes. • As an empty element under XHTML or when using XML-style syntax for HTML5, a trailing slash is required for this element: . • Under future versions of XHTML such as 2, may be dropped in favor of . • It should be noted that some core attributes for HTML5, most noticably spellcheck, make little sense within the meaning of this element. (Input Form Control) This element specifies an input control for a form. The type of input is set by the type attribute and can be a variety of different types, including single-line text field, password field, hidden, check box, radio button, or push button. HTML5 extends the possibilities of this form greatly and adds a number of features for browser-based validation without using JavaScript.
  5. 280 Part I: Core Markup Standard Syntax Attributes Introduced by HTML5 autocomplete="on | off" autofocus="autofocus" contenteditable="true | false | inherit" contextmenu="id of menu" data-X="user-defined data" draggable="true | false | auto" form="id of related form element" formaction="URL of form action" formenctype="MIME type of form encoding" formmethod="get | post | put | delete" formnovalidate="true | false" formtarget="name of target frame, region, or window" height="pixels" hidden="hidden" itemid="microdata id in URL format" itemprop="microdata value" itemref="space-separated list of IDs that may contain microdata" itemscope="itemscope" itemtype="microdata type in URL format" list="id of datalist element to get suggestions from" max="maximum value (number)" min="minimum value (number)" multiple="true | false" pattern="validation pattern as regular expression" placeholder="placeholder text" required="required"
  6. Chapter 3: HTML and XHTML Element Reference 281 spellcheck="true | false" step="float" type= older type values from above| color | date | datetime | datetime-local | email | list | number | month | range | PART I tel | time | url | search | week width="pixels" Attributes Defined by Internet Explorer autocomplete="off | on" (5) (password, text types only) dynsrc="URL of movie" (3) (image type only) language="javascript | jscript | vbs | vbscript" (4) disabled="false | true" (4) (all types except for hidden) hidefocus="true | false" (5.5) height="pixels" (3) (image type only) hspace="pixels or percentage" (3) loop="number" (4) (image type only) lowsrc="URL of low-resolution image" (4) (image type only) unselectable="off | on" (5.5) vspace="pixels or percentage" (3) (image type only) width="pixels" (3) (image type only) Standard Event Attributes onchange, onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect HTML5 Event Attributes onabort, onblur, oncanplay, oncanplaythrough, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, onformchange, onforminput, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreadystatechange, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, onvolumechange, onwaiting Events Defined by Internet Explorer onactivate, onafterupdate (checkbox, hidden, password, radio, text), onbeforeactivate (all types except hidden), onbeforecut (all types except hidden), onbeforedeactivate, onbeforeeditfocus, onbeforepaste (all types except hidden), onbeforeupdate (checkbox, hidden, password, radio, text), onblur (all types except hidden), oncontextmenu (all types except hidden), oncontrolselect, oncut (all types except hidden), ondeactivate, ondrag (all types except hidden), ondragend (all types except hidden), ondragenter (all types except hidden), ondragleave (all types except hidden), ondragover (all types except hidden), ondragstart (all types except hidden), ondrop (all types except hidden), onerrorupdate (checkbox, hidden, password, radio, text), onfilterchange (all types except hidden), onfocus, onfocusin (all types except hidden), onfocusout (all types except hidden), onhelp (all types except hidden), onlosecapture, onmouseenter (all types except hidden), onmouseleave (all types except hidden), onmousewheel (all types except hidden), onmove, onmoveend, onmovestart, onpaste (all types except hidden),
  7. 282 Part I: Core Markup onpropertychange, onreadystatechange, onresize (button, file, image, password, reset, submit, text), onresizeend, onresizestart, onselectstart (all types except hidden), ontimeerror Element-Specific Attributes accept This attribute is used to list the MIME types accepted for file uploads when using a file upload control (). align With image form controls (type="image"), this attribute aligns the image with respect to surrounding text. The HTML 4.01 transitional specification defines bottom, left, middle, right, and top as allowable values. Netscape and Microsoft browsers might also allow the use of attribute values such as absbottom or absmiddle. Like other presentation- specific aspects of HTML, the align attribute is dropped under the strict HTML 4.01 specification. alt This attribute is used to display an alternative description of image buttons for text- only browsers. The meaning of alt for forms of beyond type="input" is not defined. autocomplete This Microsoft-specific attribute is used to indicate whether or not the form field should be automatically filled in. The default value is no. HTML5 also supports this attribute. autofocus This HTML5 Boolean attribute is used to indicate that the user agent should immediately focus this form item once its containing window object (usually the document) is made active. It only takes an attribute value of autofocus when using the XML-style syntax for HTML5. It is not defined for . checked The checked attribute should be used only for check box (type="checkbox") and radio (type="radio") form controls. The presence of this attribute indicates that the control should be displayed in its checked state. disabled This attribute is used to turn off a form control. Elements will not be submitted, nor will they receive any focus from the keyboard or mouse. Disabled form controls will not be part of the tabbing order. The browser also might gray out the form that is disabled, to indicate to the user that the form control is inactive. This attribute requires no value. dynsrc In the Microsoft implementation, this attribute indicates the URL of a movie file and is used instead of the src attribute for . form This HTML5 attribute should be set to a string that corresponds to the id of the form element that an interactive control such as a button is associated with. This allows form elements in one form to trigger actions in others. formaction This HTML5 attribute specifies a URL to target when the button is clicked, similar to the use of the action attribute on a form element. formenctype This attribute indicates how form data should be encoded before being sent to the server. The default is application/x-www-form-urlencoded. This encoding replaces
  8. Chapter 3: HTML and XHTML Element Reference 283 blank characters in the data with a plus character (+) and all other nonprinting characters with a percent sign (%) followed by the character’s ASCII HEX representation. The multipart/form-data option does not perform character conversion and transfers the PART I information as a compound MIME document. This must be used when using . It also might be possible to use another encoding, such as text/plain with a mailed form, but in general you should be cautious about changing the enctype. formmethod This HTML5 attribute indicates how form information should be transferred to the server using a particular HTTP method. A get value in the attribute indicates that form data should be appended to the URL specified by the action attribute thus creating a query string. This approach is quite simple but imposes a size limitation that is difficult to gauge (may be as low as 2 kilobytes in real situations). A value of post for this attribute transfers the data of the form in the message body using the HTTP POST method, which imposes no data size limitation. Browsers may allow for other HTTP methods like delete or put, as suggested by the HTML5 specification, but so far such usage is rare. The POST method must be used when file attachments are used in a form. formnovalidate This HTML5 Boolean attribute is used to indicate a form should not be validated during submission. It is false by default but may be controlled either on the button directly or on a containing or related form. Initially this was simply known as novalidate. formtarget This HTML5 attribute is set to the name of a window or frame that the button will target the result of action; in other words, where the result should appear. This action is similar to the target attribute on and tags. Initially, this attribute was simply target in early drafts of HTML5. height Defined under HTML5, though commonly supported in older browsers, this attribute is used to size an input element particularly when images are used as in . CSS properties are preferred. hspace This Internet Explorer–specific attribute indicates the horizontal space, in pixels, between the image and surrounding text when using . list The HTML5 list attribute is used to set the id of a datalist element used to provide a predefined list of options suggested to the user for entry. loop In the Microsoft implementation, this attribute is used with and the dynsrc attribute to cause a movie to loop. Its value is either a numeric loop count or the keyword infinite. Later versions of Internet Explorer suggest using –1 to indicate infinite. lowsrc This Microsoft-supported attribute contains the URL of an image to be initially loaded when using . Typically, the lowsrc image is a low- resolution or black-and-white image that provides a quick preview of the image to follow. Once the primary image is loaded, it replaces the lowsrc image. max This HTML5 attribute should be set to a numeric value that is the high range allowed in the form control. The min attribute sets the low range.
  9. 284 Part I: Core Markup maxlength This attribute indicates the maximum content length that can be entered in a text form control (type="text"). The maximum number of characters allowed differs from the visible dimension of the form control, which is set with the size attribute. min This HTML5 attribute should be set to a numeric value that is the low range allowed in the form control. The max attribute sets the high range. multiple This HTML5 Boolean attribute, when set to true, indicates that multiple values are allowed for the field. name This attribute allows a form control to be assigned a name to set as the name/value pair value sent to the server. Traditionally, this value was also used for reference by a scripting language, but using the id value is more appropriate. However, given that browsers sometimes favor the older syntax, both may often be used and set to the same value, with some limitations, particularly with radio buttons. pattern This HTML5 attribute specifies a regular expression against which the field should be validated. The title attribute should be provided when this attribute is used, to give an indication of what is an acceptable pattern and what isn’t. placeholder This HTML5 attribute specifies a short bit of text that is used to help the user figure out what type of information to fill in for a form control. Likely, the text will be placed in the field and cleared upon focus. readonly This attribute prevents the form control’s value from being changed. Form controls with this attribute set might receive focus from the user but not permit the user to modify the value. Because it receives focus, a readonly form control will be part of the form’s tabbing order. The control’s value will be sent on form submission. This attribute can be used only with when type is set to text or password. The attribute also is used with the textarea element. required The presence of this HTML5 Boolean attribute indicates that the form field must be set in order for form submission to proceed. User agents that understand this should set the CSS pseudo-class :invalid when the field goes into error. size This attribute indicates the visible dimension, in characters, of a text form control (type="text"). This differs from the maximum length of content, which can be entered in a form control set by the maxlength attribute. src This attribute is used with image form controls (type="image") to specify the URL of the image file to load. step This HTML5 attribute defines the step in which values can take; for example, by twos (2, 4, 6…) or tens (10, 20, 30…). It is generally used in range controls. tabindex This attribute takes a numeric value that indicates the position of the form control in the tabbing index for the form. Tabbing proceeds from the lowest positive tabindex value to the highest. Negative values for tabindex will leave the form control out of the tabbing order. When tabbing is not explicitly set, the browser tabs through items in the
  10. Chapter 3: HTML and XHTML Element Reference 285 order they are encountered. Disabled form fields will not be part of the tabbing index, although read-only controls will be. PART I type This attribute specifies the type of the form control. A value of button indicates a general-purpose button with no well-defined meaning. However, an action can be associated with the button by using an event handler attribute, such as onclick. A value of checkbox indicates a check box control. Check box form controls have a checked and unchecked setting, but even if these controls are grouped together, they allow a user to select multiple check boxes simultaneously. In contrast, a value of radio indicates a radio button control. When grouped, radio buttons allow only one of the many choices to be selected at a given time. A form control type of hidden indicates a field that is not visible to the viewer but is used to store information. A hidden form control often is used to preserve state information between pages. A value of file for the type attribute indicates a control that allows the viewer to upload a file to a server. The filename can be entered in a displayed field, or a user agent might provide a special browse button that allows the user to locate the file. A value of image indicates a graphic image form control that a user can click on to invoke an associated action. (Most browsers allow the use of img-associated attributes such as height, width, hspace, vspace, and alt when the type value is set to image.) A value of password for the type attribute indicates a password entry field. A password field will not display text entered as it is typed; it might instead show a series of dots. Note that password-entered data is not transferred to the server in any secure fashion. A value of reset for the type attribute is used to insert a button that resets all controls within a form to their default values. A value of submit inserts a special submission button that, when clicked, sends the contents of the form to the location indicated by the action attribute of the enclosing tag. Lastly, a value of text (the default) for the type attribute indicates a single-line text input field. HTML5 expands greatly on this attribute’s possible values, specifying search, url, email, tel, datetime, date, month, week, time, datetime-local, number, range, and color as well. Likely there will be others. Many of these ideas derived from the Web Forms 2.0 specification, which Opera implements partially. WebKit also implements a select number of these form field types. Likely other browsers will quickly follow suit. usemap This HTML 4.0 attribute is used to indicate the map file to be associated with an image when the form control is set with type="image". The value of the attribute should be a URL of a map file but generally will be in the form of a URL fragment referencing a map file within the current file. value This attribute has two different uses, depending on the value for the type attribute. With data-entry controls (type="text" and type="password"), this attribute is used to set the default value for the control. When used with check box or radio button form controls, this attribute specifies the return value for the control. If it is not set for these fields, a default value of on will be submitted when the control is activated. vspace This Internet Explorer–specific attribute indicates the vertical space, in pixels, between the image and surrounding text when using .
  11. 286 Part I: Core Markup width This attribute, initially supported by many browsers such as Internet Explorer for image buttons and now defined under HTML5, is used to set the size of the form control, in pixels. This should be controlled with CSS instead. Examples Basics Enter your name: Enter your password: Which is your favorite food? Mexican Russian Japanese Other Three Letter Acronyms: Name: HTML5 finalized in the year   Favorite Dog: Angus Tucker Cisco Sabrina Compatibility HTML 2, 3.2, 4, 4.01, 5 Firefox 1+, Internet Explorer 2+, XHTML 1.0, 1.1, Basic Netscape 1+, Opera 2.1+, Safari 1+
  12. Chapter 3: HTML and XHTML Element Reference 287 Notes • The HTML 2.0 and 3.2 specifications support only the align, checked, maxlength, name, size, src, type, and value attributes for the input element. PART I • The HTML 4.01 specification also reserves the use of the datafld, dataformatas, and datasrc data-binding attributes. They were not included in the XHTML specification but are supported by Internet Explorer. • Use of autocomplete may have security implications. Use with caution. • Under the strict HTML and XHTML specifications, the align attribute is not allowed. • As an empty element under XHTML or when using XML-style syntax for HTML5, a trailing slash is required for this element: . • Safari running on the iPhone extends this element with autocorrect and autocapitalize attributes. Given the difficulty of filling in forms on small-factor devices, it is likely there may be other proprietary changes that are device specific. (Inserted Text) This element is used to indicate that text has been added to the document. Inserted text is generally styled with an underline. Standard Syntax Attributes Introduced by HTML5 accesskey="spaced list of accelerator key(s)" contenteditable="true | false | inherit" contextmenu="id of menu" data-X="user-defined data" draggable="true | false | auto" hidden="hidden" itemid="microdata id in URL format" itemprop="microdata value" itemref="space-separated list of IDs that may contain microdata" itemscope="itemscope" itemtype="microdata type in URL format" spellcheck="true | false" tabindex="number"
  13. 288 Part I: Core Markup Attributes Defined by Internet Explorer accesskey="key" (5.5) contenteditable=" false | true | inherit " (5.5) disabled="false | true" (5.5) hidefocus="true | false" (5.5) language="javascript | jscript | vbs | vbscript" (4) tabindex="number"(5.5) unselectable="on | off" (5.5) HTML 4 Event Attributes onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup HTML5 Event Attributes onabort, onblur, oncanplay, oncanplaythrough, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, onformchange, onforminput, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreadystatechange, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, onvolumechange, onwaiting Events Defined by Internet Explorer onactivate, onbeforedeactivate, onbeforeeditfocus, onblur, oncontrolselect, ondeactivate, onfocus, onmove, onmoveend, onmovestart, onreadystatechange, onresizeend, onresizestart, ontimeerror NOTE MSDN documentation for this element appears incorrect for event handlers. Not all core events are listed, but during testing they all worked. Other extended events like onbeforecopy, oncopy, oncontextmenu, and more were also verified as functional under Internet Explorer 8. Element-Specific Attributes cite The value of this attribute is a URL that designates a source document or message for the information inserted. This attribute is intended to point to information explaining why the text was changed. datetime This attribute is used to indicate the date and time the insertion was made. The value of the attribute is a date in a special format as defined by ISO 8601. The basic date format is yyyy-mm-ddthh:mm:ssTZD where the following is true: yyyy=four-digit year such as 2010 mm=two-digit month (01=January, 02=February, and so on) dd=two-digit day of the month (01 through 31)
  14. Chapter 3: HTML and XHTML Element Reference 289 hh=two-digit hour (00 to 23) (24-hour clock not AM or PM) mm=two-digit minute (00 to 59) ss=two-digit second (00 to 59) tzd=time zone designator PART I The time zone designator is either Z, which indicates Universal Time Coordinate or coordinated universal time format (UTC), or +hh:mm, which indicates that the time is a local time that is hh hours and mm minutes ahead of UTC. Alternatively, the format for the time zone designator could be –hh:mm, which indicates that the local time is behind UTC. Note that the letter T actually appears in the string, all digits must be used, and 00 values for minutes and seconds might be required. An example value for the datetime attribute might be 2009-10-6T09:15:00-05:00, which corresponds to October 6, 2010, 9:15 A.M., U.S. Eastern Standard Time. Example We have the lowest prices in the galaxy! New rates are effective in 2010. Compatibility HTML 4, 4.01, 5 Firefox 1+, Internet Explorer 4+, XHTML 1.0, 1.1 Netscape 6+, Opera 4+, Safari 1+ Note • Browsers can render inserted () or deleted () text in a different style to show the changes that have been made to the document. Typically, newly inserted entries are underlined and deletions appear with strikethrough. In theory, a browser could have a way to show a revision history on a document, but generally this is left up to scripting or the environment the page is built in. (Index Prompt) This element indicates that a document has an associated searchable keyword index. When a browser encounters this element, it inserts a query entry field at that point in the document. The viewer can enter query terms to perform a search. This element is deprecated under the strict HTML and XHTML specifications and should not be used. Standard Syntax (Transitional Only)
  15. 290 Part I: Core Markup Attributes Defined by Internet Explorer accesskey="key" (5.5) action="URL to send query" (3) contenteditable=" false | true | inherit" (5.5) disabled="false | true" (5.5) hidefocus="true | false" (5.5) language="javascript | jscript | vbs | vbscript" (4) tabindex="number" (5.5) unselectable="on| off" (5.5) Events Defined by Internet Explorer onactivate, onbeforedeactivate, onbeforeeditfocus, onblur, oncontrolselect, ondeactivate, onfocus, onmove, onmoveend, onmovestart, onreadystatechange, onresize, onresizeend, onresizestart Element-Specific Attributes action This attribute specifies the URL of the query action to be executed when the viewer presses the ENTER key. Although this attribute is not defined under any HTML specification, it is common to many browsers, particularly Internet Explorer 3, which defined it. prompt This attribute allows a custom query prompt to be defined. The default prompt is “This is a searchable index. Enter search keywords.” Examples Compatibility HTML 2, 3.2, 4, 4.01 (transitional) Firefox 1+, Internet Explorer 4+, XHTML 1.0 (transitional) Netscape 1.1+, Opera 4+, Safari 1+ Notes • Originally, the W3C intended this element to be used in a document’s header. Browser vendors have relaxed this usage to allow the element in a document’s body. Early implementations did not support the action attribute and used a tag or an href attribute to specify a search function’s URL. • As an empty element, requires no closing tag under HTML specifications. However, under the XHTML specification, a trailing slash is required. • The HTML 3.2 specification only allows the prompt attribute, whereas HTML 2 expected a text description to accompany the search field.
  16. Chapter 3: HTML and XHTML Element Reference 291 • Netscape 1.1 originated the use of the prompt attribute. • This element is not found at all in newer specifications like HTML5. PART I (Keyboard Input) This inline element logically indicates text as keyboard input. A browser generally renders text enclosed by this element in a monospaced font. Standard Syntax Attributes Introduced by HTML5 accesskey="spaced list of accelerator key(s)" contenteditable="true | false | inherit" contextmenu="id of menu" data-X="user-defined data" draggable="true | false | auto" hidden="hidden" itemid="microdata id in URL format" itemprop="microdata value" itemref="space-separated list of IDs that may contain microdata" itemscope="itemscope" itemtype="microdata type in URL format" spellcheck="true | false" tabindex="number" Attributes Defined by Internet Explorer accesskey="key" (5.5) contenteditable=" false | true | inherit" (5.5) disabled="false | true" (5.5) hidefocus="true | false" (5.5) language="javascript | jscript | vbs | vbscript" (4) tabindex="number" (5.5) unselectable="on | off" (5.5) HTML 4 Event Attributes onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup HTML5 Event Attributes onabort, onblur, oncanplay, oncanplaythrough, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave,
  17. 292 Part I: Core Markup ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, onformchange, onforminput, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreadystatechange, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, onvolumechange, onwaiting Events Defined by Internet Explorer onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, onclick, oncontextmenu, oncontrolselect, oncopy, oncut, ondblclick, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onkeydown, onkeypress, onkeyup, onlosecapture, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror Example On a Linux or Unix based system you can list files by typing ls at a command prompt. Compatibility HTML 2, 3.2, 4, 4.01, 5 Firefox 1+, Internet Explorer 2+, XHTML 1.0, 1.1, Basic Netscape 1+, Opera 4+, Safari 1+ Note • The HTML 2 and 3.2 specifications support no attributes for this element. (Key Pair Generation) This element is used to control the generation of key pairs in secured communications. On form submission, the browser will generate a key pair and store the private key in the browser’s private key storage and send the public key to the server. HTML5 Standard Syntax
  18. Chapter 3: HTML and XHTML Element Reference 293 id="unique alphanumeric identifier" itemid="microdata id in URL format" itemprop="microdata value" itemref="space-separated list of IDs that may contain microdata" PART I itemscope="itemscope" itemtype="microdata type in URL format" keytype="enumerated value for type of key (generally rsa)" lang="language code" name="field name" spellcheck="true | false" style="style information" tabindex="number" title="advisory text"> HTML5 Event Attributes onabort, onblur, oncanplay, oncanplaythrough, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, onformchange, onforminput, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreadystatechange, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, onvolumechange, onwaiting Example keygen Example Compatibility HTML5 Browsers such as Netscape, Firefox, Safari, and Opera may have partial support for this element. Notes • As an empty element when using XML-style syntax for HTML5, a trailing slash is required for this element: .
  19. 294 Part I: Core Markup • This element was initially introduced by Netscape and, although it has been poorly documented, has been formalized for HTML5. There is strong indication that some browser vendors like Microsoft may not support this element or support it only as a dummy element. (Form Control Label) This element is used to relate descriptions to form controls. Standard Syntax Attributes Introduced by HTML5 accesskey="spaced list of accelerator key(s)" contenteditable="true | false | inherit" contextmenu="id of menu" data-X="user-defined data" draggable="true | false | auto" hidden="hidden" itemid="microdata id in URL format" itemprop="microdata value" itemref="space-separated list of IDs that may contain microdata" itemscope="itemscope" itemtype="microdata type in URL format" spellcheck="true | false" tabindex="number" Attributes Defined by Internet Explorer contenteditable="false | true | inherit" (5.5) datafld="column name" (4) dataformatas="html | text" (4) datasrc="data source id" (4) disabled="false | true" (5.5) hidefocus="true | false" (5.5) language="javascript | jscript | vbs | vbscript" (4) tabindex="number" (5.5) unselectable="on | off" (5.5) HTML 4 Event Attributes onblur, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup
  20. Chapter 3: HTML and XHTML Element Reference 295 HTML5 Event Attributes onabort, onblur, oncanplay, oncanplaythrough, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, PART I ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, onformchange, onforminput, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreadystatechange, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, onvolumechange, onwaiting Events Defined by Internet Explorer onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, onclick, oncontextmenu, oncontrolselect, oncopy, oncut, ondblclick, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onkeydown, onkeypress, onkeyup, onlosecapture, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror Element-Specific Attributes for This attribute specifies the id for the form control element the label references. This is optional when the label encloses the form control it is bound to. In many cases, particularly when a table is used to structure the form, a tag will not be able to enclose the associated form control, so the for attribute should be used. This attribute allows more than one label to be associated with the same control by creating multiple references. Examples Search: Name Compatibility HTML 4, 4.01, 5 Firefox 1+, Internet Explorer 4+, XHTML 1.0, 1.1, Basic Netscape 6+, Opera 4+, Safari 1+
Đồng bộ tài khoản