tailieunhanh - JavaScript Bible, Gold Edition part 111

JavaScript Bible, Gold Edition part 111. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | 948 Part IV JavaScript Core Language Reference Listing 34-9 continued page JavaScript can create HTML on the fly. P Numerous string object methods facilitate creating text that is boldfaced .bold italicized .italics or even the terribly annoying blinking text .blink . page SCRIPT BODY HTML Of the remaining string methods two more and string. fontcolor also affect the font characteristics of strings displayed in the HTML page. The parameters for these items are pretty straightforward an integer between 1 and 7 corresponding to the seven browser font sizes and a color value as either a hexadecimal triplet or color constant name for the designated text. Listing 34-10 adds a line of text to the string of Listing 34-9. This line of text not only adjusts the font size of some parts of the string but also nests multiple attributes inside one another to set the color of one word in a large-font-size string. Because these string methods do not change the content of the string you can safely nest methods here. Listing 34-10 Nested String Methods HTML HEAD TITLE HTML by JavaScript TITLE HEAD BODY SCRIPT LANGUAGE JavaScript var page page JavaScript can create HTML on the fly. P Numerous string object methods facilitate creating text that is boldfaced .bold italicized .italics or even the terribly annoying blinking text .blink . P page We can make some words big .fontsize 5 and some words both big and colorful .fontcolor coral .fontsize 5 at the same time. page SCRIPT BODY HTML The final two string methods let you create an anchor and a link out of a string. The method uses its parameter to create a name for the anchor. Thus the following expression Table of Contents .anchor toc Chapter 34 The String Object 949 evaluates to A NAME toc Table of Contents A In a similar fashion the string .link method expects a valid location or URL as its parameter creating a genuine HTML link out of the string Back to Home .link .

TỪ KHÓA LIÊN QUAN