Start learning with our library of video tutorials taught by experts. Get started

JavaScript Essential Training
Watching:

Introduction to JavaScript


From:

JavaScript Essential Training

with Simon Allardice

Video: Introduction to JavaScript

So before we start writing some JavaScript, let's get some core concepts cleared up. It's very common to see JavaScript referred to as one of the three core languages of web pages. You have the HTML markup language for content and structure. What's your headline, how many divisions are in your page, how many paragraphs do you have, what are the contents of those paragraphs? Then the CSS, the style sheet language, for presentation. What font does the headline use, what's the background color of the page, what's the width of the div that the paragraphs are in? And JavaScript, the programming language for your behavior and interactivity.
Expand all | Collapse all
  1. 3m 28s
    1. Welcome
      1m 1s
    2. What you should know
      1m 44s
    3. Using the exercise files
      43s
  2. 15m 41s
    1. Introduction to JavaScript
      8m 6s
    2. Creating your first JavaScript
      2m 13s
    3. Getting to know the tools and applications
      5m 22s
  3. 56m 8s
    1. Understanding the structure of JavaScript code
      7m 9s
    2. Where to write your JavaScript
      3m 56s
    3. Creating variables
      6m 21s
    4. Working with conditional code
      5m 44s
    5. Working with operators
      13m 28s
    6. Sending messages to the console
      2m 59s
    7. Working with loops
      8m 1s
    8. Creating functions
      8m 30s
  4. 36m 13s
    1. Working with arrays
      7m 57s
    2. Working with numbers
      6m 13s
    3. Working with strings
      8m 27s
    4. Working with dates
      5m 38s
    5. Working with objects
      7m 58s
  5. 9m 6s
    1. What is the DOM?
      5m 49s
    2. Working with nodes and elements
      3m 17s
  6. 25m 17s
    1. Accessing DOM elements
      11m 3s
    2. Changing DOM elements
      5m 42s
    3. Creating DOM elements
      8m 32s
  7. 24m 45s
    1. Introduction to JavaScript event handling
      8m 16s
    2. Working with onClick and onLoad events
      7m 36s
    3. Working with onBlur and onFocus events
      2m 36s
    4. Working with timers
      6m 17s
  8. 21m 41s
    1. Common JavaScript errors
      7m 14s
    2. Using Firebug
      4m 7s
    3. Going through a debugging session
      10m 20s
  9. 10m 13s
    1. Accessing form elements
      4m 20s
    2. Preventing a form from being submitted
      2m 36s
    3. Hiding and showing form sections
      3m 17s
  10. 9m 49s
    1. CSS and JavaScript
      3m 46s
    2. Removing and applying CSS classes
      2m 16s
    3. Changing inline styles
      3m 47s
  11. 19m 44s
    1. Understanding JavaScript style
      7m 39s
    2. Minifying your code
      4m 28s
    3. Using JavaScript code checkers
      7m 37s
  12. 22m 24s
    1. Introduction to JavaScript libraries
      3m 17s
    2. Linking to multiple JavaScript files
      2m 11s
    3. Introduction to jQuery
      12m 7s
    4. Using a content distribution network to deliver JavaScript files
      4m 49s
  13. 17m 35s
    1. JavaScript in HTML5
      9m 37s
    2. Using Modernizr
      3m 2s
    3. Using Strict Mode
      4m 56s
  14. 33m 3s
    1. Knowing the JavaScript to avoid
      6m 35s
    2. Introduction to regular expressions
      6m 56s
    3. Working with AJAX
      10m 44s
    4. Working with objects and prototypes
      8m 48s
  15. 21m 10s
    1. Example: Countdown
      8m 3s
    2. Example: Resize
      5m 47s
    3. Example: Accordion
      7m 20s
  16. 4m 58s
    1. Where to go from here
      4m 0s
    2. Goodbye
      58s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
JavaScript Essential Training
5h 31m Beginner Jul 22, 2011

Viewers: in countries Watching now:

Use JavaScript to add new features and a richer, more compelling user interface on web pages. This course keeps current best practices and practical uses for JavaScript in mind, while covering syntax, working with the DOM, and developing and debugging across multiple platforms, devices, and browsers. Author Simon Allardice also shows how to progressively enhance and gracefully degrade web pages, and take advantage of the world of JavaScript libraries now available.

Topics include:
  • Understanding the structure of JavaScript code
  • Creating variables, functions, and loops
  • Writing conditional code
  • Sending messages to the console
  • Working with different variable types and objects
  • Creating and changing DOM objects
  • Event handling
  • Working with timers
  • Debugging JavaScript
  • Building smarter forms
  • Working with CSS, HTML5, and JavaScript
  • Using regular expressions
Subjects:
Developer Web Programming Languages Web Development
Software:
JavaScript
Author:
Simon Allardice

Introduction to JavaScript

So before we start writing some JavaScript, let's get some core concepts cleared up. It's very common to see JavaScript referred to as one of the three core languages of web pages. You have the HTML markup language for content and structure. What's your headline, how many divisions are in your page, how many paragraphs do you have, what are the contents of those paragraphs? Then the CSS, the style sheet language, for presentation. What font does the headline use, what's the background color of the page, what's the width of the div that the paragraphs are in? And JavaScript, the programming language for your behavior and interactivity.

What happens when you mouse over a menu, what happens when you type the wrong value in a form field, how long does a photo slideshow take to move from one image to the next? JavaScript is a programming language that you'll often hear it referred to as a scripting language, and sometimes you'll hear some software developers dismiss JavaScript as just being a scripting language. And what they mean by that is that JavaScript is intentionally limited. I can't write a desktop application in JavaScript the way I might do with C++ or Java or .NET or Objective-C.

JavaScript only works inside another application, the web browser. Whether that's IE or Safari or Firefox or Chrome or Opera, they all have a JavaScript engine inside them. The operating system runs the web browser, the web browser contains a page, and the page contains the JavaScript. Now another way JavaScript is limited is that yes, it doesn't have access to the file system of the computer that it's running on. There are no words in JavaScript to open or save local files because that would be a security risk.

There are no words in JavaScript to talk to a database or target a USB port. And that strikes some software developers as odd because most languages are all about input and output, and JavaScript isn't. But of course, they're missing the point. JavaScript wasn't designed as a general purpose programming language; it was designed to manipulate web pages and it does that very well. Now as you know, when a user opens their browser and requests a page from your web site, they're just send HTML and CSS as plain text, and you let their browser take care of interpreting and rendering it however their browser wants to, whether it's mobile, whether it's on a laptop or a desktop, and it's the same with JavaScript.

JavaScript is a client-side language. It is sent to the user's computer and it runs there. That's as opposed to server-side technologies like PHP, ASP.NET, Ruby on Rails. They'll execute their code on the web server and deliver the results to the client. But with JavaScript, we just send our code to the client and we let them run it. I'm going to just interject a side note here. JavaScript was designed to run as a scripting language using a web browser as a host program.

That's why it was invented. But because it has become so popular, it has in recent years popped up as a scripting language in other applications, and even in server-side products. So you'll find it in things like Adobe Acrobat and Photoshop. JavaScript is in server-side products like Node.js and Google Apps Script. But in this course, I'm not focusing on those uses of JavaScript. I'm talking about classic JavaScript, a client-side language used to add interactivity to web pages. Now if you're interested in JavaScript for any other reason, use this course to learn the core of the language, and then you can jump into those other applications.

So back to talking about JavaScript as a client-side language. One impact of this is that because JavaScript is sent to the client, to the user, is what if the user has disabled JavaScript in their browser? Well, then we can send it over, but it won't do anything. It will be as if the JavaScript never existed. Now while this situation is less common these days than it used to be, that does mean we need to do our best to write web sites that will work whether or not JavaScript is enabled. But yes, we want to add all of this cool functionality, but if the user doesn't have JavaScript, the web site still works.

It might have more limited interactivity, but it's still perfectly usable. Now another issue can be the variety of browsers out there. Just has different browsers can render and display web pages differently, usually because they don't handle CSS exactly the same way, what happens if they handle JavaScript differently? Well, this was one of the reasons why JavaScript had a bad reputation for a long time. Go back a few years and a lot of JavaScript had to be written to detect the browser and handle different browsers in different ways.

And I'm very happy to tell you that's not really an issue anymore. There are a few edge cases, but typically we don't care what browser the user has. And to understand why, let's do a super-quick history lesson here. So JavaScript was developed in 1995 by Brendan Eich at Netscape, and it first became built into a web browser with Netscape 2. It was originally going to be called LiveScript. But because Sun's Java language was the new big deal at the time, Netscape and Sun had an agreement to rename LiveScript to JavaScript to jump on that popularity bandwagon of Java.

And most people these days agree this was a bad idea and caused a lot of confusion. The two languages have nothing to do with each other. If you're brand-new to programming, they might look a little similar to you, but that's because they both really look like C. So JavaScript is not Java. It is not a light version of Java. It was not based on Java. It doesn't matter if you know Java, and we will talk no more on the matter. Now as it became popular in Netscape, Microsoft then made their own version for Internet Explorer.

They couldn't call it JavaScript, so they called it JScript, and we had more browser differences to deal with. And what happened, thankfully, then was that Netscape submitted the language to the ECMA or ECMA standards body to create an independent and officially standardized edition, and they did. The standardized edition of this language is officially called ECMAScript, and it was first published in '97. And really what we're doing in this course is ECMAScript. That's a name by a committee, so everyone just called it JavaScript, even though Mozilla officially owned the JavaScript name.

Now ECMAScript has had a few different editions, but the one we care about is edition 3, which may surprise you. It was published way back in 1999, but that's the one that you can reliably assume full support for in every major browser, and it's the one we're going to focus on in this course. ECMAScript Version 5 was published at the end of 2009 and adds a few features to the language, particularly in the advanced area.

But I'm recording this course in mid-2011. ECMAScript 5 is only now getting some support in the most recent browser versions. Adoptions of standards like this take years, and yes, at some point in the future ECMAScript 5 will be the standard, but it isn't yet. And just to let you know, compatibility was a big deal in development of ECMAScript 5, so everything we do in this course will be compatible moving forward and it will also work in all the older browsers for many years to come. Now if you're wondering what happened to ECMAScript 4 in those ten years between edition 3 and edition 5, well it just got way out of hand and they abandoned it; ECMAScript 4 never happened.

Now, one of the benefits of having a standardized language like this is it doesn't matter if you're a Mac, PC, or Linux person, it doesn't matter if your server is Windows or Apache, if your backend is PHP or Ruby on Rails or ASP.NET or ColdFusion or none of the above; JavaScript is completely agnostic on these matters. There's no special tools required. There's no licensing needed. Sure, as with editing HTML and CSS, some applications may make our life a little easier, but all we really need is a basic text editor.

There are currently no FAQs about JavaScript Essential Training.

Share a link to this course
Please wait... Please wait...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed JavaScript Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked

Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.