Danh mục

Introduction to JavaScript

Số trang: 13      Loại file: pdf      Dung lượng: 690.88 KB      Lượt xem: 12      Lượt tải: 0    
tailieu_vip

Phí tải xuống: 5,000 VND Tải xuống file đầy đủ (13 trang) 0
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Welcome to JavaScript: A Beginner’s Guide! You’re obviously interestedin learning JavaScript, but perhaps you’re not sure what you needto know to use it. This module answers some basic questions about whatJavaScript is, discusses its advantages and limitations, explains how youcan use it to create more dynamic and inviting Web pages, and providesa brief history of the language.
Nội dung trích xuất từ tài liệu:
Introduction to JavaScriptModule Introduction to 1 JavaScriptThe Goals of This Module q Understand the role of text editors in using JavaScript q Understand the role of Web browsers in using JavaScript q Review which types of text editors and Web browsers are recommended for coding with JavaScript q Introduce the JavaScript language q Understand how to use HTML with JavaScript2 JavaScript: A Beginner’s Guide W elcome to JavaScript: A Beginner’s Guide! You’re obviously interested in learning JavaScript, but perhaps you’re not sure what you need to know to use it. This module answers some basic questions about what JavaScript is, discusses its advantages and limitations, explains how you can use it to create more dynamic and inviting Web pages, and provides a brief history of the language. JavaScript is ubiquitous on the World Wide Web. It can help your pages become more interactive, allowing them to react to a viewer’s actions or allowing you to have some special effects (visual or otherwise) on your pages. JavaScript often gets thrown in with Hypertext Markup Language (HTML) as one of the recommended languages for beginning Web developers (whether you build Web sites for business or pleasure). Of course, you can build a Web page by using only HTML, but JavaScript allows you to add additional features that a static page of HTML can’t provide without some sort of scripting or programming help. What You Need to Know Before you begin learning about JavaScript, you should have a basic knowledge of the following: q HTML q Text editors q Web browsers q The different versions of JavaScript If you have this basic knowledge (and most likely you do), then you’ll do just fine as you work through this book. Knowing another programming/scripting language or having previous experience with JavaScript isn’t required. This book is a beginner’s guide to JavaScript. If you think you don’t have enough experience in one of the aforementioned areas, a closer look at each one may help you decide what to do. Module 1: Introduction to JavaScript 3Basic HTML Knowledge 1While you don’t need to be an HTML guru, you will need to knowwhere to place certain elements (like the head and body elements) andhow to add your own attributes. This book will often reference scripts inthe head section (between the and tags) and thebody section (between the and tags). Occasionally, you will also need to add an attribute to a tag for a scriptto function properly. For example, you may need to name a form elementusing the name attribute, as shown in the following code:If you know the basics of using tags and attributes, the HTML portionshouldn’t pose any problems to learning JavaScript. If you don’t have a basic knowledge of HTML, you can learn itfairly quickly through a number of mediums. For example, you can buya book or look for some helpful information on the Web. A good bookis HTML: A Beginner’s Guide by Wendy Willard (Osborne, 2000). Tofind information about HTML on the Web, check out these sites: http://www.pageresource.com/html/ and http://htmlgoodies.earthweb.com.Basic Text Editor and Web BrowserKnowledgeBefore jumping in and coding with JavaScript, you must be able to use atext editor or HTML editor, and a Web browser. You’ll use these tools tocode your scripts.Text EditorsA number of text editors and HTML editors support JavaScript. If youknow HTML, you’ve probably already used an HTML editor to createyour HTML files, so you might not have to change. However, some HTML editors have problems related to addingJavaScript code (such as changing where the code is placed or alteringthe code itself when you save the file). You may need to use a simplereditor or look for an HTML editor that handles the addition of yourown JavaScript code easily. Some examples of text editors are Notepad,TextPad, and Simple Text.4 JavaScript: A Beginner’s Guide Web Browsers Again, if you’ve been coding in HTML, you probably won’t need to change your browser. However, some browsers have trouble with the newer versions of JavaScript. The choice of Web browser is ultimately up to you, as long as it’s compatible with JavaScript. I recommend one of the following browsers to test your JavaScript code: q Microsoft Internet Explorer version 4.0 or later q Netscape Navigator version 4.0 or later New versions of these browsers continue to be produced. At the time of this writing, nonbeta versions of Internet Explorer 5.5 and Netscape Navigator 4.7 are available. To give you an idea of what each browser looks like, Figure 1-1 shows a Web page when viewed in Microsoft Internet Explorer. Figure 1-2 shows the same page when viewed in Netscape Navigator.Figure 1-1 A Web page viewed in Microsoft Internet Explorer Module 1: Introduction to JavaScript 5 1Figure 1-2 A Web page viewed in Netscape Navigator If you have an older browser and you can’t upgrade, a number of features (mostly discussed later in the book) may not work in that browser. Even so, the book can still help you learn the JavaScript language itself, so you don’t ...

Tài liệu được xem nhiều: