Sorted by:  

How to Use Text to Integrate JavaScript with HTML

As far as JavaScript is concerned, strings are just one of many data types web developers can use to integrate with HTML. The text or string data type is the presentation format that most humans think [more…]

How to Use Arrays to Integrate JavaScript with HTML

In JavaScript, arrays are a kind of collection. You can work with arrays to integrate JavaScript with HTML. Each array contains zero or more like items that you can manipulate as a group. [more…]

How to Use JavaScript Objects for HTML Integration

JavaScript comes with a host of built-in objects that help you perform general programming tasks. You can create a new variable of any type you want. JavaScript also supports a number of other built-in [more…]

How to Use JavaScript Object Literals for HTML Integration

In JavaScript, an object literal is a special kind of data collection. It contains named values that you use to make accessing a particular value easier. The idea is to create a package that you can send [more…]

How to Manipulate and Search JavaScript Strings to Program with HTML

In JavaScript, strings are what most humans equate to computer data because people see output onscreen as strings. Fortunately, JavaScript provides a wealth of ways in which to interact with strings. [more…]

How to Use the Date Object to Integrate JavaScript with HTML

Dates are used in all sorts of ways, but the most common techniques you must master in JavaScript applications are formatting and time span calculation. People want dates and times formatted in a way they [more…]

How to Use JavaScript’s Built-In Functions to Program with HTML

JavaScript gives you access a number of built-in functions, including the prompt() function, which lets you ask the user for written input. As with the [more…]

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

The Math object is a special sort of object in JavaScript — you use it to access math-related functionality, rather than create new objects. As with any JavaScript object, you can create an instance of [more…]

How to Reduce Work with Custom Functions in JavaScript

Using custom functions helps reduce the work you must perform in JavaScript when creating an application and integrating with HTML. Functions help you reduce your workload in the following ways: [more…]

How to Create Custom Functions with a Return Value in JavaScript

Many of the built-in functions in JavaScript provide some sort of return value to program with HTML, and you can create functions that provide a return value, too. Use a return value when the function [more…]

How to Create Custom Functions with Optional and Required Arguments in JavaScript

All arguments for a JavaScript function are optional. In fact, the caller can send as many arguments as desired to program with HTML. Of course, if you’re expecting only one argument, then you’ll process [more…]

How to Work with JavaScript’s Private Properties and Methods to Program with HTML

Many web developers are under the impression that JavaScript doesn’t provide private properties or methods. This isn’t the case. It’s true that JavaScript does lack any specific keyword that designates [more…]

When to Use the if Statement to Program HTML with JavaScript

You really can’t escape using the if statement with JavaScript. The if statement is commonly used for testing whether something has happened or not, whether the data is in range or not, or whether the [more…]

When to Use the switch Statement to Program HTML with JavaScript

Although the if statement is commonly used for simple choices in JavaScript, the switch statement is used to handle a range of choices. A switch provides an elegant way to handle variable data. There are [more…]

What You Should Know About Loops to Program HTML with JavaScript

The term loop brings up visions of circles. In some respects, when you create a loop in your JavaScript application, the application goes in circles. It keeps going in circles until you tell it to stop [more…]

How to Make Your First JavaScript for Loop

A for loop is best used in situations where you know you want to perform a specific number of cycles in HTML programming. You don’t necessarily know the number of cycles when you create the application [more…]

How to Use JavaScript’s break Statement

The break statement lets you stop loop execution in HTML programming, even if the stop expression conditions aren’t met. There are many reasons to use the [more…]

How to Use JavaScript’s continue Statement

The continue statement in JavaScript stops processing for the current loop cycle. However, in HTML programming, processing continues with the next loop cycle. Although you would generally use a [more…]

How to Create while Loops in JavaScript

Web developers commonly use whileloops when there’s no definite ending for a loop in HTML programming. The environment or data must meet a specific condition before the loop stops. With this in mind, it’s [more…]

How to Catch Errors in JavaScript

When developers are programming HTML with JavaScript, a number of errors can creep up. The basic idea behind error trapping is to try one or more tasks to determine whether they’ll work as anticipated. [more…]

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…]


Sign Up for RSS Feeds

Computers & Software