• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Matt Doyle | Elated Communications

Web and WordPress Development

  • About Me
  • Blog
    • Design & Multimedia
      • Photoshop
      • Paint Shop Pro
      • Video & Audio
    • Online Marketing
      • E-Commerce
      • Social Media
    • Running a Website
      • WordPress
      • Apache
      • UNIX and Linux
      • Using FTP
    • Web Development
      • HTML
      • CSS
      • JavaScript
      • PHP
      • Perl and CGI Scripting
  • Portfolio
  • Contact Me
  • Hire Me
Home / Blog / Web Development / JavaScript

JavaScript

Covers JavaScript, the most popular browser scripting language, and some clever tips & tricks.

See also:
  • The Document Object Model
  • jQuery
  • JavaScript Arrays

JavaScript Array Basics

5 May 2008 / 4 Comments

Like most languages, JavaScript lets you create arrays to store bunches of values in. An array is simply a sequence, or list, of values. A value in a JavaScript array can be anything from a number or string, through to a function or an object; JavaScript arrays can store pretty much any type of data. A single value in a JavaScript array is called an element.

With JavaScript arrays, you can:

  • Store any number of values, including no values at all (known as an empty array)
  • Access any or all the elements of an array through a single variable name
  • Read and write elements of an array
  • Loop through all the elements of an array
  • Join two or more arrays together to make one longer array
  • Convert an array to one long string
  • Add or remove elements from the beginning, end, or middle of an array
  • Reverse the order of the elements in an array
  • Sort the elements of an array in any order you like
  • Nest arrays within other arrays

JavaScript stores arrays as Array objects, so most of the things you can do with arrays revolve around the properties and methods of the Array class.

In this introductory article, you look at creating arrays, accessing the contents of arrays, the concept of array lengths, and looping through arrays.

[Read more…] about JavaScript Array Basics

Creating a JavaScript Clock

20 February 2007 / 48 Comments

One of the great things about JavaScript is that it lets you manipulate the contents of a Web page in real-time. This means that we can use JavaScript to create a digital clock, embedded in the Web page, that updates every second. This article shows you how to do just that.

[Read more…] about Creating a JavaScript Clock

JavaScript Timers with setTimeout and setInterval

15 January 2007 / 24 Comments

JavaScript features a handy couple of methods of the window object: setTimeout() and setInterval(). These let you run a piece of JavaScript code at some point in the future. In this tutorial we’ll explain how these two methods work, and give some practical examples.

[Read more…] about JavaScript Timers with setTimeout and setInterval

Working with Strings

15 November 2005 / Leave a Comment

In this reference article we’ll explain what strings are, why they’re important, and how they work in JavaScript. We’ll cover all the properties and methods of strings, along with some simple examples.

[Read more…] about Working with Strings

Preventing Multiple Form Submits

4 April 2005 / 4 Comments

Forms on websites are a handy way to get information from your visitors. However it’s easy for a visitor to accidentally send more than one copy of a form by clicking on the form’s “submit” button more than once. The end result can be that identical emails get sent to the Webmaster, or identical records get added to a database.

This handy little tutorial shows how you can use JavaScript in your Web pages to avoid forms being submitted more than once by a visitor.

[Read more…] about Preventing Multiple Form Submits

Fun with Random Numbers

18 December 2004 / Leave a Comment

We can use JavaScript to generate random numbers, that is, numbers that are different each time the script is run. This allows us to do all sorts of fun stuff, such as:

  • Show a random image or piece of text on the page
  • Make a link that links to a random page
  • Create games that people can play in their browser

First, let’s look at how we can create a random number in JavaScript.
[Read more…] about Fun with Random Numbers

Working with Dates

19 November 2002 / 6 Comments

JavaScript’s Date object makes it easy to handle dates in JavaScript. You can use this object to store dates, convert between date formats, and retrieve the current date and time.

In this tutorial we’ll take a look at using the Date object, and end with a simple example script that displays the current date on the web page!

[Read more…] about Working with Dates

JavaScript and Cookies

31 October 2002 / 9 Comments

A great feature of JavaScript is that it lets you set and retrieve browser cookies. In this tutorial I’ll show you how this is done, along with a simple example that remembers your name and displays it on every page.

[Read more…] about JavaScript and Cookies

Controlling Program Flow in JavaScript

23 August 2002 / Leave a Comment

One of the key features of all good programming languages is the ability to control the order in which actions are performed. For instance, you may want to run one piece of code if the user has selected a checkbox, but run a different piece of code if they haven’t selected it. Or, you may want to run the same piece of code 10 times (for example, if you’re creating a drop-down list with 10 items).

In this tutorial you’ll learn how to write code to make decisions (e.g. “if the user has selected this checkbox, display this message”), and perform the same action many times (called “looping”).

[Read more…] about Controlling Program Flow in JavaScript

JavaScript Events and Event Handlers

11 December 2001 / 3 Comments

In this tutorial we’re going to take a look at a very handy feature of JavaScript called events. By writing code that reacts to events, you can make your web pages much more interactive!

Read on to find out how…

[Read more…] about JavaScript Events and Event Handlers

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 3
  • Go to page 4
  • Go to page 5
  • Go to page 6
  • Go to Next Page »

Primary Sidebar

Hire Matt!

Matt Doyle headshot

Need a little help with your website? I have over 20 years of web development experience under my belt. Let’s chat!

Matt Doyle - Codeable Expert Certificate

Hire Me Today

Call Me: +61 2 8006 0622

Stay in Touch!

Subscribe to get a quick email whenever I add new articles, free goodies, or special offers. I won’t spam you.

Subscribe

Recent Posts

  • Make a Rotatable 3D Product Boxshot with Three.js
  • Speed Up Your WordPress Website: 11 Simple Steps to a Faster Site
  • Reboot!
  • Wordfence Tutorial: How to Keep Your WordPress Site Safe from Hackers
  • How to Make Awesome-Looking Images for Your Website

Footer

Contact Matt

  • Email Me
  • Call Me: +61 2 8006 0622

Follow Matt

  • E-mail
  • Facebook
  • GitHub
  • LinkedIn
  • Twitter

Copyright © 1996-2023 Elated Communications. All rights reserved.
Affiliate Disclaimer | Privacy Policy | Terms of Use | Service T&C | Credits