tailieunhanh - How to Do Everything with Web 2.0 Mashups phần 3

JavaScript là giống như hầu hết các ngôn ngữ lập trình và kịch bản: bạn có thể tạo ra các biến, sử dụng điều khiển như các vòng lặp và các cấu trúc if / else, và tạo ra chức năng. Một trong những tính năng quan trọng nhất của JavaScript là lệnh , | Simpo PDF Merge and Split UnWWediVcej iOQn WS WWWi imp0pdf 0m 49 Understand JavaScript Structure JavaScript is like most programming and scripting languages you can create variables use controls such as loops and if else constructs and create functions. One of the most important features of JavaScript is the command which takes a parameter that is text to be output onto the HTML page in which the script resides. Thus you can write the following code in JavaScript. For more details on the actual syntax see the section Use JavaScript Objects. Hello World. Place JavaScript Scripts in Script Elements Scripts can be placed on HTML pages in script elements. The type attribute identifies the scripting language as in the following code snippet 5 script type text javascript Hello World. script NOTE Use Scripts from an External Source with the src Attribute Script elements may have an src attribute in addition to the type attribute. If an src attribute exists it points to a script located somewhere outside the file containing the HTML code. Such a script element is placed wherever you would normally place the script code on the page. Here is an example of an external script script src http maps file api v 2 key yourkey type text javascript script Note the src attribute contains not only the location of the script on the Web but also some additional information such as the version number and the unique key that can be used to access it. This is the script you use for the Google Maps API. In this code snippet as well as others in this book the code has been adjusted to fit on the printed page. As a general rule you can type longer lines of text into an editor for HTML JavaScript or other languages. Unless clearly indicated do not worry about duplicating the line breaks shown in the text. Also be aware that many of the code snippets for mashup APIs include unique identifiers and keys which you must obtain before .