JavaScript

View:  
Sorted by:  

How to Throw Errors in JavaScript to Program with HTML

There are times when you can’t handle an error in JavaScript or you can’t handle it in the location where the error occurs. Throwing an error means creating a new [more…]

How to Access HTML Program Elements in JavaScript

Whether you want to change content, presentation, or interaction, you must gain access to an individual HTML element to do it. For example, if you want to change the caption on a button, you must have [more…]

How to Use JavaScript’s Event Object to Program with HTML

Any event handler in JavaScript can receive an Event object that describes the event. Even when you programmatically assign an event handler to an event, the event handler still has access to the [more…]

How to Use JavaScript’s Document Event Object to Program with HTML

The Document Event object is unique in that it lets you create other events in JavaScript. You use the createEvent() method to create an event that could simulate something like a mouse click. Even though [more…]

How to Use JavaScript’s Mouse and Keyboard Event Objects to Program with HTML

The Mouse and Keyboard event objects in JavaScript are essentially the same. They provide the same properties and methods. The only difference is that you use one with a mouse and the other with the keyboard [more…]

How to Use the XMLHttpRequest Object in JavaScript

It may at first seem that JavaScript’s XMLHttpRequest object is intensely complicated, but it really isn’t if you take it apart and view it a bit at a time. In reality, most developers use only a few well-known [more…]

How to Create Custom Events in JavaScript to Program with HTML

The standard events provided with JavaScript perform well for most common tasks. But, sometimes, you will need a custom event. For example, you must have a method of performing a click, and JavaScript [more…]

How to Change HTML Elements in JavaScript

The focus of CSS is on the HTML element. CSS answers the question of how a <p> tag appears to the viewer. There are two methods of working with HTML elements statically: as part of the individual tag and [more…]

How to Build Dynamic HTML Elements in JavaScript

One of the building blocks for creating special effects for any page is the ability to make dynamic HTML changes to the page. For example, you may want to create a special effect for the selected element [more…]

How to Create JavaScript-Based Menus to Program with HTML

The concept of a JavaScript-based menu is straightforward. When you hover a mouse pointer over a menu, it opens any submenu and lets you choose one of the options on the submenu, if desired. Moving the [more…]

How to Access HTML Form Elements in JavaScript

As with any other HTML elements, you can interact directly with HTML5 elements in JavaScript. The trick is to ensure that the elements you choose will work with the browsers and platforms you need to support [more…]

How to Validate HTML Form Elements in JavaScript

Validation is an important part of working with HTML forms. Unfortunately, not every browser provides support for the validation features of HTML5. The example you find here won’t work with Internet Explorer [more…]

How to Find a Location with JavaScript

Knowing your location is an important part of working with JavaScript applications in a browser environment. The location object makes it possible to determine the current location that the user is viewing [more…]

How to Use the Navigator Object in JavaScript

The navigator object provides support for a number of interesting properties and methods in JavaScript. All of these properties and methods tell you something about the browser used to access the page. [more…]

How to Create Pop-Ups in JavaScript

JavaScript provides access to three kinds of dialog boxes: alert(), confirm(), and prompt(). You can do multiple things with pop-ups. For example, you can make information appear on multiple lines in these [more…]

How to Use Cookies in JavaScript

Cookies store application information on the user’s drive. When a user visits a site, the JavaScript application can use a cookie to store information for future use. Some cookies are quite simple and [more…]

How to Display XML with JavaScript on an HTML5 Page

XML is a great way to store data with JavaScript. However, it isn’t the easiest way to see the data. All of the tags tend to hide the data rather than make it easy to understand. A generated XML file tends [more…]

How to Validate XML with JavaScript on an HTML5 Page

One of the strengths of XML is that it presents data in a highly structured manner making the context of the data understandable for JavaScript. However, one of the weaknesses of XML is that it doesn’t [more…]

How to Load XML with JavaScript on an HTML5 Page

Many we developers explore XML as a storage technology. You can also interact with XML files using a combination of JavaScript and HTML5. The example shows how you could parse an XML document by using [more…]

Why You Should Use AJAX with JavaScript on an HTML5 Page

Many JavaScript users and web developers have heard of AJAX, assumed it was a special sort of language, and never went any further. AJAX isn’t a new language; it’s a reuse of existing technology to create [more…]

How to Perform AJAX Tasks with JavaScript

Using AJAX with pure JavaScript is a two-part process. First, you must send the request. Second, you must process the response. The following code shows the two parts of the process used to change just [more…]

How to Load jQuery from Google CDN to Use with JavaScript

Many web developers use multiple libraries, like Google Content Distribution Network (CDN), when creating a JavaScript application because each library has something special to offer. Each reference to [more…]

Server-Side Programs with JavaScript

It’s entirely possible that your real world production JavaScript application won’t require any sort of server-side processing — that all your application will ever need is to grab resources in the form [more…]

How to Use HTML5 and JavaScript to Canvas Your Web Page

HTML5 includes the concept of a canvas. As with the artist’s version of the physical canvas, you use the HTML5 canvas to draw images onscreen. Using the canvas makes it easier to manage various sorts of [more…]

How to Retrieve Results from AJAX Calls with JavaScript

It’s time to build a few JavaScript applications to see what jQuery can do for you when you’re retrieving results from AJAX calls. Although your real-world situations will be more complex, the process [more…]

Listings:1-2526-5051-7576-100more...

Sign Up for RSS Feeds

Computers & Software

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.