|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
Figure 6.5 Document illustrating the new generic attributes. The attributes CLASS=under and ID=through associate the style sheet rules (at the top of the document) to the formatting of the associated element. The TITLE attribute of the third paragraph element associates a tool-tip text pop-up with the paragraph text. The hypertext link at the top of the document is linked to the final paragraph (ID=label1). This link is supported on Internet Explorer 4, but not Netscape Navigator 4. <HTML> <HEAD><TITLE> Attribute Tester: TITLE, CLASS, ID, STYLE, ID, STYLE, DIR </TITLE> </HEAD> <STYLE> <!-- .under {text-decoration: underline} /* rule for underline */ #through {text-decoration: line-through} /* rule for strike-through */ --> </STYLE> <BODY BGCOLOR=white> <H3>Attribute Tester: TITLE, CLASS, ID, STYLE, and DIR</H3> <P>Here is a paragraph. This paragraph contains a <A HREF=#label1>hypertext anchor</A> pointing to the reference label1. </P> <P ID=through>Here is a paragraph with <B>ID</B>=through. There is a CSS rule associated with this ID value, such that a browser should render this paragraph with a line struck through the text.</P> <P TITLE=Funny Paragraph>This paragraph contains an <EM CLASS=under>EM element</EM> of <B>CLASS</B>=under. The associated CSS rule should underline the section of emphasized text. The paragraph also has the attribute <B>TITLE</B>=Funny Paragraph. </P> <P>This paragraph has two <B>SPAN</B> elements that use the <B>DIR</B> attribute to change text directionality.Here they are:<BR> <B><TT>DIR=ltr:</TT></B> <SPAN DIR=ltr>A span of left to right text</SPAN><BR> <B><TT>DIR=rtl:</TT></B> <SPAN DIR=rtl>A span of right to left text</SPAN></P> <P ID=label1>A final paragraph, of <B>ID</B>=label1. The hypertext reference at the top of the page should link to here.</P> </BODY></HTML>
Event-Handler Element AttributesHTML 4 defines 18 special event-handling attributes, listed in the following section. Event handling attributes relate HTML elements to script programs that should be run when the corresponding event happens to the element. For example, an onMouseOver event occurs whenever the mouse pointer moves on top of an element. Thus if an element has the attribute onMouseOver=handler_program() then the program handler_program() will be run whenever the mouse moves over the element. The programs themselves must be included within the document and are written in either JavaScript or VBScript. To mark the special nature of the event handling attributes, they are written in this book in mixed upper- and lowercase. The different HTML 4 attributes are listed in Table 6.7, alongside a list of elements to which they apply. Note, however, that most current browsers do not support all these attributes/element pairs, and also do support several other, nonstandard event handling attributes. For a more detailed description of the level of support for event-handling attributes by current browsers, please read the Scripting in HTML Documents section in Chapter 7. Basic Structure: HTML, HEAD, and BODYThe basic structure of an HTML document is laid out by the HTML, HEAD, and BODY elements. HTML Element: An HTML Document
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |