tailieunhanh - Học JavaScript qua ví dụ part 4

Nơi để Đặt JavaScript Trước khi học tập JavaScript, bạn nên quen thuộc với HTML và làm thế nào để tạo một tài liệu HTML. Điều này không có nghĩa là bạn phải có một chuyên gia, nhưng bạn nên quen thuộc với cấu trúc của tài liệu HTML và cách các thẻ được sử dụng để hiển thị các loại nội dung trên trình duyệt của bạn. | 20 Chapter 1 Introduction to JavaScript Where to Put JavaScript Before learning JavaScript you should be familiar with HTML and how to create an HTML document. This doesn t mean that you have to be an expert but you should be familiar with the structure of HTML documents and how the tags are used to display various kinds of content on your browser. Once you have a static HTML document then adding basic JavaScript statements is quite easy. Go to http for an excellent HTML tutorial. In this text we have devoted a separate chapter to CSS. CSS allows you to control the style and layout of your Web page by changing fonts colors backgrounds margins and so on in a single file. With HTML CSS and JavaScript you can create a Web site with structure style and action. Client-side JavaScript programs are embedded in an HTML document between HTML head tags head and head or between the body tags body and body . Many developers prefer to put JavaScript code within the head tags and at times as you will see later it is the best place to store function definitions and objects. If you want text displayed at a specific spot in the document you might want to place the JavaScript code within the body tags as shown in Example . Or you might have multiple scripts within a page and place the JavaScript code within both the head and body tags. In either case a JavaScript program starts with a script tag and ends with a script tag. And if the JavaScript code is going to be long and involved or may be shared by multiple pages it should be placed in an external file text file ending in .js and loaded into the page. In fact once you start developing Web pages with JavasScript it is customary to separate the HTML CSS content from the programming logic JavaScript by creating separate files for each entity. When a document is sent to the browser it reads each line of HTML code from top to bottom and processes and displays it. As JavaScript code is encountered it is read

TỪ KHÓA LIÊN QUAN