![]() |
Example of Dynamically changing Text style![]() ![]() ![]() ![]() ![]()
The example, which is laid out, improves the usability of the Web page by dynamically presenting the story headlines one at a time. If a reader is interested in only one town's news, he or she will be able to move his or her mouse cursor to that town's identifier and read just the story in which he or she is interested. If only one story is presented at a time, you can add more information to the Web page without it appearing cluttered. As a representation of additional information, the day's projected high temperature has been added to the page.
The news stories are loaded initially with a font size of 2 points. At 2 points, the stories are not readable, so the emphasis is on the information to the left, A reader can see the high temperatures for each town in the valley and, if he or she is interested in the top news story for a certain town, can move the mouse over that town's name and the news story headline will appear large to the right. This example focuses on the onmouseover event as the initiating event for changing text. Example of dynamic text styles <HTML> <BODY BGCOLOR=#FFFFF> <HEAD> <TITLE> Today's High Temperatures </TITLE> <BODY> <H3> The India News </H3> <TABLE> <P ID = T1 CLASS ="redPlain" onmouseover ="redP ();"> Chennai 71 T2CLASS="redPlain" onmouseover ="redP ()';"Banngalore63 <P 10 = T3 CLASS ="redPlain" onmouseover ="redP (),">Delhi 69 source = window.event.srcElement; T1 . className="redPlain"; T2.className="redPlain"; T3. className="redPlain"; PGI. className="redSmall";
if (TI. className=='blackplain") }
The first step, defines the styles you will use within the page. The redPlain style has been applied to all text blocks that have a CLASS=redPlain attribute in their opening tag. The redSmall style is red with a 2-point font and no styling. The blackPlain style is black with a 16-point font and no styling. The second step, apply the appropriate attributes to the opening tags for each text block that contains the changing style feature. Each <P> tag for the town and temperature text looks like the first one: <P ID=T1 CLASS= "redPlain" onmouseover="redP();"> It contains an ID attribute to name the paragraph, a CLASS attribute to set a style for initial loading, and an EVENT attribute to initiate an action and associate the appropriate script function to that action. The third step is to write the script functions that handle the events we added in the text block tags. Each town header calls only one script when the mouse passes over. The script is placed within the <SCRIPT> </SCRIPT> tag pair. The redP( ) function resets each town header and news story back to their initial styles and then enlarges the appropriate items based on the mouse cursor position on the page. The script is simplified by the line. sourse = window.event.srcElement Dynamic HTML includes the capability to read the object that initialized an event through the window.event.srcElement method. Be sure to declare the variable where you want to store the event earlier in the function. Through the source variable, the appropriate town header changes to the blackPlain style. After it is changed, to town headers are interrogated to find the black one. Then, the respective news story headline's is enlarged as well.
|
|
Domain NamesDHTML Document Object Model Features of Dynamic HTML HTML Versus DHTML Netscape's Vision of DHTML Microsoft Vision of DHTML Cascading Style Sheets(CSS) Inline Style Sheets Embedded Style for a Page Linked Cascading Style Sheet Text Specific Style AttributesCSS Attributes Assigning Classes Java Script Style Sheets(JSSS) Object Property Functions Methods
Creating Style Sheets with JSSS New JSSS Methods Working Layers Positioning the Layer Using More than One Layer Moving a Layer Around on the Page Events
The mouseOver and mouseOut Events The mouseMove Event The Keyboard Events The mouseDown and mouseUp Events The dragDrop Event Error Event Form Event The Script Tag Changing Text Color Inline Text Attribute Changes Text Dynamically Changing StylesExample of Dynamically Changing Style Dynamically Changing Content HTML Replacement Changing Text Content An Example of HTML Graphics ReplacementWeb DesignWeb HostingE Commerce |
| Home | Web Hosting | Web Design | Sitemap |
| Copyright (C) 2007. Web Domain design hosting. All rights reserved. |