• Complain

Shelley Powers [Shelley Powers] - Learning JavaScript, 2nd Edition

Here you can read online Shelley Powers [Shelley Powers] - Learning JavaScript, 2nd Edition full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2008, publisher: O’Reilly Media, Inc., genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Shelley Powers [Shelley Powers] Learning JavaScript, 2nd Edition

Learning JavaScript, 2nd Edition: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Learning JavaScript, 2nd Edition" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

If youre new to JavaScript, or an experienced web developer looking to improve your skills, Learning JavaScript provides you with complete, no-nonsense coverage of this quirky yet essential language for web development. Youll learn everything from primitive data types to complex features, including JavaScript elements involved with Ajax and dynamic page effects. By the end of the book, youll be able to work with even the most sophisticated libraries and web applications.
Complete with best practices and examples of JavaScript use, this new edition shows you how to integrate the language with the browser environment, and how to practice proper coding techniques for standards-compliant websites. This book will help you:

  • Learn the JavaScript application structure, including basic statements and control structures
  • Identify JavaScript objectsString, Number, Boolean, Function, and more
  • Use browser debugging tools and troubleshooting techniques
  • Understand event handling, form events, and JavaScript applications with forms
  • Develop with the Browser Object Model, the Document Object Model, and custom objects you create
  • Learn about browser cookies and more modern client-side storage techniques
  • Get details for using XML or JSON with Ajax applications
Learning JavaScript follows proven learning principles to help you absorb the concepts at an easy pace, so youll learn how to create powerful and responsive applications in any browser.

Shelley Powers [Shelley Powers]: author's other books


Who wrote Learning JavaScript, 2nd Edition? Find out the surname, the name of the author of the book and a list of all author's works by series.

Learning JavaScript, 2nd Edition — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Learning JavaScript, 2nd Edition" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
About the Author

Shelley Powers has been working with, and writing about, web technologies--from the first release of JavaScript to the latest graphics and design tools--for more than 12 years. Her recent O'Reilly books have covered the semantic web, Ajax, JavaScript, and web graphics. She's an avid amateur photographer and web development aficionado, who enjoys applying her latest experiments on her many web sites.

Chapter 1. Hello JavaScript!

One reason JavaScript is so popular is that its relatively easy to add JavaScript to a web page. All you need to do, at a minimum, is include an HTML script element in the page, specify "text/javascript" for the type attribute, and add whatever JavaScript you want:

...some JavaScript

Installation is not required, nor do you have to torturously work through any odd library path configurations. JavaScript works, straight out of the box and in most web browsers, including the big four: Firefox, Internet Explorer, Opera, and Safari. All you need to do is add a scripting block, and youre in business.

Traditionally, you add JavaScript blocks to the head element . All of the examples in this book add scripting blocks only to the web page head section.

Hello World!

Also traditionally, the first example when learning a new programming language is known as Hello, Worlda simple application that prints out Hello, World! to the user interface, whatever it may be. In the case of JavaScript, the user interface is the web page. the words Hello, World!

Example 1-1. The smallest JavaScript application: Hello, World!

Hello, World!alert("Hello, World!");

Copying into a file and opening the file in web browsers that support JavaScript should result in an alert box that reads Hello, World! If it doesnt, you might want to make sure you have JavaScript enabled.

Note

Older versions of Internet Explorer also disable script if you open the page via the File Open menu rather than by using a web page address such as http:///index.html.

This application, although very limited in functionality, more or less demonstrates the minimum components of a JavaScript application: you have a web page, you have a script element, and you have a line of JavaScript. Try it yourself, except edit the string by replacing World with your first name.

Of course, if you want to move beyond just outputting a static message to the browser, youll need to extend the example somewhat.

Hello World! Once Again

Another variation of the Hello, World! application actually writes the message to the web page rather than in an alert box. To do so, it makes use of four important JavaScript application components: the built-in .

Example 1-2. Hello, World! printed out to the web page

Hello, World!function hello() { // say hello to the world var msg = "Hello, World!"; document.open(); document.write(msg); document.close();}

Hi

Though is a very small application, it does expose several of the basic components of most JavaScript applications in use today, each of which deserves a closer look. In the rest of this chapter, well take that closer look, one component at a time.

Note

Not covered in this chapter is the.

The script Tag

JavaScript is frequently used within the context of another language, such as markup languages like HTML and XHTML. However, you cant just plop JavaScript into the markup wherever and however you want.

In , the script element encloses the JavaScript. This lets the browser know that when it encounters the script elements opening tag, it shouldnt process the elements contents as HTML or XHTML. At this point, control over the content is turned over to the browsers scripting engine.

Not all script embedded in web pages is JavaScript, and the script element opening tag contains an attribute defining the type of script. In the example, this is given as text/javascript. Among other allowable values for the type attribute are:

  • text/ecmascript

  • text/jscript

  • text/vbscript

  • text/vbs

The first type value listed specifies that the script is interpreted as ECMAScript, based on the ECMA-262 scripting standard. The next value causes the script to be interpreted as JScript, a variation of ECMAScript that Microsoft implements in Internet Explorer. The last two values are for Microsofts VBScript, a completely different scripting language.

All of these type values describe the MIME type of the content. MIME , or Multipurpose Internet Mail Extension, is a way to identify how the content is encoded (i.e., text), and its specific format (javascript). By providing a MIME type, those browsers capable of processing the type do so, whereas other browsers skip over the section. This ensures that only applications that can process the script actually access the script.

Earlier versions of the script tag took a language attribute, which was used to designate the version of the language, as well as the type: javascript1.2 as compared to javascript1.1. However, the use of language was deprecated in HTML 4.01, though it still appears in many JavaScript examples. And therein lies one of the earliest cross-browser techniques.

Note

I use the term cross-browser to denote JavaScript that works across all target browsers, or uses functionality to manage any browser differences so that the application works cross-browser.

Years ago, when working with cross-browser compatibility issues, it wasnt uncommon to create a specific script for each browser in a separate section or file and then use the language attribute to ensure that only a compatible browser could access the code. Looking through some of my old examples (circa 1997), I found the following:

The philosophy of this approach was that only a browser capable of processing JavaScript 1.2 would pick up the first file (primarily Netscape Navigator 4.x at that time) and only a browser capable of processing JScript would pick up the second file (Internet Explorer 4). Kludgey? Sure, but it also worked through the early years of trying to deal with frequently broken cross-browser dynamic page effects.

Other valid script attributes are

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Learning JavaScript, 2nd Edition»

Look at similar books to Learning JavaScript, 2nd Edition. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Learning JavaScript, 2nd Edition»

Discussion, reviews of the book Learning JavaScript, 2nd Edition and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.