O'Reilly logo

JavaScript Application Cookbook by Jerry Bradenbaugh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Potential Extension: Adding Attributes to the Template

Big applications can always be made bigger. This section is devoted to showing you how to add attributes to the image template, giving you greater control over the generated code. For the sake of simplicity, I’ll show you how to add the IMG attributes HSPACE and VSPACE. The procedure involves these six steps:

  1. Add the new fields in the default template.

  2. Create an array for its values in setArrays().

  3. Capture the new default values.

  4. Add text fields in the image template in generateEntryForm().

  5. Reference and assign the new attribute values in genJavaScript().

  6. Generate the HTML required to display the attributes in genJavaScript().

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required