tailieunhanh - JavaScript Bible, Gold Edition part 7
JavaScript Bible, Gold Edition part 7. 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. | 24 Part I Getting Started with JavaScript Below the rule the script displays plain body text that combines static text with information about the browser you use to load the document. The script writes a stream of HTML information to the browser including a tag to render a portion of the information in boldface. Even though two lines of code are writing information to the page the result is rendered as one line just as it is when all the text is hard-coded in HTML. Entering Your First Script It s time to start creating your first JavaScript script. Launch your text editor and browser. If your browser offers to dial your Internet service provider ISP or begins dialing automatically cancel or quit the dialing operation. If the browser s Stop button is active click it to halt any network searching it may try to do. You may receive a dialog box message indicating that the URL for your browser s home page usually the home page of the browser s publisher unless you ve changed the settings is unavailable. That s fine. You want the browser open but you shouldn t be connected to your ISP. If you re automatically connected via a local area network in your office or school that s also fine. However you don t need the network connection for now. Next follow these steps to enter and preview your first JavaScript script 1. Activate your text editor and create a new blank document. 2. Type the script into the window exactly as shown in Listing 3-1. Listing 3-1 Source Code for HTML HEAD TITLE My First Script TITLE HEAD BODY H1 Let s Script. H1 HR SCRIPT LANGUAGE JavaScript -- hide from old browsers This browser is version of B B . end script hiding -- SCRIPT BODY HTML 3. Save the document with the name . This is the lowest common denominator filenaming convention for Windows feel free to use an .html extension if your operating system allows it. 4. Switch to your browser. Chapter 3 Your
đang nạp các trang xem trước