TAILIEUCHUNG - Học JavaScript qua ví dụ part 5

Script Setup Các tài liệu HTML và JavaScript Không giống như các kịch bản Perl và Python, JavaScript kịch bản chương trình không đứng một mình. Họ đang chạy trong bối cảnh của một tài liệu HTML. Khi lập trình trên máy khách, bước đầu tiên sẽ được để tạo ra một tài liệu HTML trong trình soạn thảo yêu thích của bạn, chẳng hạn như UNIX vi hoặc emacs, hoặc Windows Notepad, 1 WordPad, hoặc TextPad | chapter 2 Script Setup The HTML Document and JavaScript Unlike Perl and Python scripts JavaScript scripts are not stand-alone programs. They are run in the context of an HTML document. When programming on the client side the first step will be to create an HTML document in your favorite text editor such as UNIX vi or emacs or Windows Notepad 1 WordPad or TextPad see Figure . There are a number of popular integrated development environments IDEs such as NetBeans Komodo Edit and Eclipse with highlighting validation debugging features and so on you might prefer to use. A list of recommended IDEs can be found at http downloads . Because the file you create is an HTML document its name must include either an .html or .htm extension. JavaScript programs can be embedded within the HTML document between the script and script tags. Figures and show an HTML file containing JavaScript code. Figure JavaScript in TextPad editor. 1. If you are using Windows Notepad be sure to turn off word wrap under the Format menu to avoid errors in your program. 29 From the Library of 30 Chapter 2 Script Setup Figure JavaScript in PSPad Editor a popular free IDE with many features. Script Execution Because a JavaScript program is embedded in an HTML document you will execute it in your browser window. If you are using an IDE the browser is part of the integrated environment but either way you can execute a JavaScript program directly in the browser. If using Mozilla Firefox Opera or Internet Explorer follow these instructions From the Library of The HTML Document and JavaScript 31 1. Go to the File menu and open the HTML file by browsing for the correct one. 2. All files in the www folder are displayed. The .html extension on the files will appear in the browser s URL. From the Library of .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.