1. Home
  2. Computing & Technology
  3. JavaScript

Bubbles

2. Obtain the Script

clr gif
Join the Discussion

Questions? Comments?

More of this Feature

Introduction Add to Your Page

Related Terms

DHTML DOM

To make bubbles on your web page you first need to select the code from the text box below (there is a highlight all button beneath it to make this easier) and copy it into a file called bubbles.js.

The only line in the Javascript that you may want to alter is the one that sets the number of bubbles that are displayed.

bubbles image The other thing that you will need to copy is the bubble image. To do this in most browsers simply right click on the double sized static bubble image at the start of this paragraph and select save picture as or save image (depending on which browser you are using). You need to save the image as bubble.gif. If you are not puting the image in the same folder as the web page then you will need to update the bubbles variable to reflect the correct location of the image in order for the script to work. If you don't want to use the image supplied, you are welcome to use your own image and if you want more than one image just add more images to the bubbles array separating the filenames with commas.

Now all that remains is to add the script to your page.

Sample Page | Obtain the Script | Add to Your Page
Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.