Click the box titles below to expand:

How to's

XSLT

GOOGLE MAPS API

PHP

Antelope

Perl

Document Object Model (DOM)

UNIX

Generic Mapping Tools (GMT)

Miscellaneous

Projects

Courses Taught

Latest Favorites

Mac OS X

Web Development

Beta

How To :: Using the Document Object Model (DOM) for dynamic content

The DOM is a powerful force for dynamically changing webpage content based on user interaction without having to load/reload a webpage. This page is basically me documenting the experiments I have done using the DOM as applied to practical problems. I hope you find it useful.

Expand your form field dynamically

The problem: I was looking for a way to dynamically create form fields within a table so users can upload a photo caption and a file.

Solution 1: The Basics

My first solution worked on Safari, Mozilla (Apple & Windows) but not Internet Explorer for Windows. I was originally using the createElement DOM tag to create a new table row (<tr>) tag and two table cells (<td>). The names of the fields are slightly complex as I creating associative arrays for processing in PHP and I wanted to ensure the caption fields matched the file names. This solution is bascially a replication of Bin-Blog's solution.