TAILIEUCHUNG - XML Step by Step- P20

XML Step by Step- P20:Extensible Markup Language, or XML, is currently the most promising language for storing and exchanging information on the World Wide Web. Although Hypertext Markup Language (HTML) is presently the most common language used to create Web pages, HTML has a limited capacity for storing information. In contrast, because XML allows you to create your own elements, attributes, and document structure, you can use it to describe virtually any kind of information from a simple recipe to a complex database | Chapter 10 Displaying XML Documents Using Data Binding 351 BUTTON ONCLICK FindBooks Search BUTTON HR Results P DIV ID ResultDiv DIV SCRIPT LANGUAGE JavaScript function FindBooks SearchString if SearchString ltYou must enter text into Title text box. gt return ResultHTML while TitleString TITLE .value if .indexOf SearchString 0 ResultHTML I TITLE I B AUTHOR B BINDING PAGES pages PRICE P Data Binding 10 352 XML Step by Step if ResultHTML ltno books found gt else ResultHTML SCRIPT BODY HTML Listing 10-13. The HTML page displays a TEXT type INPUT element which lets the user enter a single line of search text INPUT TYPE TEXT ID SearchText The page also displays a BUTTON element labeled Search BUTTON ONCLICK FindBooks Search BUTTON When the user clicks the button the FindBooks script function is called which extracts the search text from the INPUT element searches the titles of all BOOK records in the XML document for the text and then displays the matching BOOK records as shown here The script function FindBooks is contained in its own SCRIPT element and is written in JScript 354 XML Step by Step tip JScript is Microsoft s version of the generic JavaScript scripting language. In the example SCRIPT block the LANGUAGE attribute gives the generic language name. For information on JScript and other Microsoft Web scripting technologies see the topic Scripting in the MSDN Library on the Web at http library . The FindBooks function begins by obtaining the text currently entered into the INPUT element which has the ID SearchText and then using the JScript method toUpperCase to convert the text to uppercase. FindBooks .

4    3    0    11-08-2020
6    4    0    11-08-2020
131    4    0    11-08-2020
4    3    0    11-08-2020
19    16    0
182    15    0
138    6    0
3    7    0
142    12    0