More Info


You are in: home > javascript > javascript api >
download the API

JavaScript API

Introduction

This is a simple API (Application Programming Interface) for creating dHTML pages.

There's nothing even remotely new here, but I use this code in many of the other scripts on the site so I thought I'd explain how it works.

The API provides the following functionality:

  • Basic Browser Sniffing - Not a complete browser sniffer, it only highlights those browsers that can cause problems for the API. read more
  • Get Style Object - Returns the Style object for a given page element. read more
  • Change Object Visibility - Hides or shows an element. read more
  • Find Image (NS4 only) - Used to find image objects in NS4. read more
  • Find object (NS4 only) - Used to find other objects in NS4. read more
  • Get Element Width/Height - Gets the width or height of any page element (not images in NS4). read more
  • Get Element Top/Left - Get the page co-ordinates of any element (not images in NS4). read more
  • Get Image width/Height - Gets the width or height of any image. read more
  • Get Image Top/Left - Get the page co-ordinates of any image. read more
  • Move Element - Sets the x and y co-ordinates of an element. read more
  • Change Style Class - changes the style class of an object (Not NS4 or Opera 5/6). read more
  • Change Image - changes the source of an image element. read more
  • Change Background Colour - changes the background colour of an element. read more

In these pages I'll refer to the three types of browsers. These are the DOM Browsers (MSIE 6+, Netscape 6+, Mozilla, Opera 7+, Konqueror etc), Internet Explorer 4/5 and Netscape 4.x.

The DOM browsers use document.getElementById to reference object, Internet Explorer uses document.all, Netscape 4.x uses document.layers.

Most of the functions in the API have three sections, one for each of the three browser types.

  NEXT PAGE: Browser Sniffer >>





 © James Austin 2002-05 Web site design by James Austin