« Home « Kết quả tìm kiếm

Introduction to JavaScript


Tóm tắt Xem thử

- 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.
- 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:.
- Text editors.
- 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..
- While you don’t need to be an HTML guru, you will need to know where to place certain elements (like the head and body elements) and how to add your own attributes.
- This book will often reference scripts in the head section (between the <HEAD>.
- Occasionally, you will also need to add an attribute to a tag for a script to function properly.
- For example, you may need to name a form element using the name attribute, as shown in the following code:.
- If you don’t have a basic knowledge of HTML, you can learn it fairly quickly through a number of mediums.
- For example, you can buy a book or look for some helpful information on the Web.
- To find information about HTML on the Web, check out these sites: http://.
- www.pageresource.com/html/ and http://htmlgoodies.earthweb.com..
- Text Editors.
- If you know HTML, you’ve probably already used an HTML editor to create your HTML files, so you might not have to change..
- You may need to use a simpler editor or look for an HTML editor that handles the addition of your own JavaScript code easily.
- Again, if you’ve been coding in HTML, you probably won’t need to change your browser.
- I recommend one of the following browsers to test your JavaScript code:.
- Microsoft Internet Explorer version 4.0 or later.
- Figure 1-1 A Web page viewed in Microsoft Internet Explorer.
- 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 need to give up if you have an older browser..
- For a complete listing (which includes a number of popular browsers, and addresses platform issues like which version is used in Windows or a Macintosh in the same browser), see this excellent online reference: http://www.webreview.com/browsers/browsers.shtml..
- Figure 1-2 A Web page viewed in Netscape Navigator.
- (Some of the newer ones will likely support JavaScript 1.3.).
- A browser version of 3.0 or earlier may support only JavaScript 1.0 or 1.1, which is why I suggested version 4.0 or later of the recommended browsers.
- JavaScript 1.4 is currently in the works and already has some documentation from Netscape at http://developer.netscape.com/docs/.
- it can use server-side languages to perform more complex.
- msdn.microsoft.com/scripting/default.htm..
- www.jsworld.com/ecmascript..
- Microsoft Internet Explorer Version.
- If you have experience with Java, C.
- or C, you’ll notice some similarities in the syntax, which may help you learn more quickly..
- Answer: A text editor is a program that you can use to save and edit written text.
- You can also purchase and download some from the Web, like NoteTab or TextPad..
- recommend a plain text editor or an HTML editor that doesn’t change any code you add to it manually.
- Question: What exactly do I need to know about using a text editor?.
- Answer: Basically, you only need to know how to type plain text into the editor, save the file with an .html or .htm extension, and be able to open it again and edit it if necessary.
- The news release of the new language came on December 4, 1995, back when Netscape Navigator 2.0 Question: What do I need to know about using a browser?.
- Answer: All you absolutely need to know is how to open a local HTML file on your computer (or on the Web) and how to reload a page..
- If you don’t know how to open an HTML file from your own computer, open your browser and go to the File menu.
- Answer: Microsoft Internet Explorer: http://www.microsoft.com/ie Netscape Navigator: http://home.netscape.com/computing/download.
- (See http://home.netscape.com/newsref/pr/.
- newsrelease67.html for the news release.) JavaScript version 1.0 became available with the new browser.
- JavaScript is an object-based, client-side scripting language that you can use to make Web pages more dynamic.
- You’ll learn how to work with JavaScript objects in Module 8.
- You don’t need to understand them in any detail until you know a few other features of the language..
- Client Side.
- Client side means that JavaScript runs in the client (software) that the viewer is using, rather than on the Web server of the site serving the page.
- To make more sense of this, let’s take a look at how a server-side language works and how a client-side language works..
- Server-Side Languages.
- A server-side language needs to get information from the Web page or the Web browser, send it to a program that is run on the host’s server, and then send the information back to the browser.
- Therefore, an intermediate step must send and retrieve information from the server before the results of the program are seen in the browser..
- A server-side language often gives the programmer options that a client-side language doesn’t have, such as saving information on the Web server for later use, or using the new information to update a Web page and save the updates..
- However, a server-side language is likely to be limited in its ability to deal with special features of the browser window that can be accessed with a client-side language (like the content seen in the status bar of a browser window or the contents of a form before it’s submitted to the server)..
- Client-Side Languages.
- A client-side language is run directly through the client being used by the viewer.
- In the case of JavaScript, the client is a Web browser.
- Therefore, JavaScript is run directly in the Web browser and doesn’t need to go through the extra step of sending and retrieving information from the Web server..
- With a client-side language, the browser reads and interprets the code, and the results can be given to the viewer without getting information from the server first.
- A client-side language can also access special features of a browser window that may not be possible with a server-side language.
- However, a client-side language lacks the ability to save files or updates to files on a Web server like a server-side language can..
- A client-side language is most useful for tasks that deal with parts of the browser or that allow information to be validated before it is sent to a server-side program or script.
- For instance, JavaScript can open a new window with specific dimensions, specific features (such as a toolbar or status bar), and its point of placement on the screen..
- JavaScript can also be used to check the information entered into a form before it is sent to a server-side program to be processed.
- The information can prevent strain on the Web server by preventing submissions with inaccurate or incomplete information.
- Rather than running the program on the server until the information is correct, that data can be sent to the server just once with correct information..
- All the interpretation is done on the fly by the client..
- and then, after that, you can run the program.
- With a scripting language, the code is interpreted as it is loaded in the client.
- Thus, you can test the results of your code more quickly..
- In the case of JavaScript, the error handling is up to the browser being used by the viewer..
- You might wonder where to write your JavaScript code and what tells the browser it is different than anything else on a Web page.
- JavaScript runs in the browser by being added directly into an existing HTML document.
- You can add special tags and commands to the HTML code that will tell the browser that it needs to run a script.
- Once the browser sees these, it interprets the JavaScript commands and will do what you have directed it to do with your code.
- Thus, by simply editing an HTML document, you can begin using JavaScript on your Web pages and see the results..
- For example, the following code adds some JavaScript to an HTML file that writes some text onto the Web page.
- The next module looks at how to add JavaScript in an HTML file by using the <SCRIPT>.
- This will be your first step on the road to becoming a JavaScript coder!.
- A place to find tutorials with working examples of the results:.
- http://www.pageresource.com/jscript.
- This tag tells the browser that JavaScript follows.
- This line writes the text inside the quote marks on the page This line tells the.
- browser that this is the end of the script.
- http://www.wsabstract.com.
- A place where you can address questions about JavaScript to fellow coders: http://www.javascriptcity.com/forums.
- The script writes a line of text in the browser using JavaScript..
- JavaScript is an object-oriented, client-side scripting language that can be used to make Web pages more dynamic.
- You must know which of the following to be able to use JavaScript?.
- Which of the following is something you should have to use JavaScript?.
- A Web browser B.
- How can a client-side language help when using forms on a Web page?.
- It can save the information on the server..
- It can validate the information before it is sent to the server..
- It is written into a special editor in the browser..
- It is taken from a compiled program on the server..
- It is added to an HTML document.

Xem thử không khả dụng, vui lòng xem tại trang nguồn
hoặc xem Tóm tắt