14.08.2016 Views

Beginning JavaScript with DOM Scripting and Ajax, 2nd Edition

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 10 ■ Modern <strong>JavaScript</strong> Case Study: A Dynamic Gallery<br />

badge.js (continued)<br />

deletePic : function() {<br />

badge.container.innerHTML = ' ';<br />

}<br />

}<br />

<strong>DOM</strong>help.addEvent(window, 'load', badge.init, false);<br />

All the deletePic method needs to do is to set the innerHTML property of the container element to an empty<br />

string, thus removing the large image.<br />

Summary<br />

In this chapter, you learned how to enhance already existing HTML structures or dynamic server-side scripts for<br />

thumbnail galleries <strong>with</strong> <strong>JavaScript</strong> either to become dynamic or to appear more dynamic by not loading the whole<br />

document when the user chooses another image or thumbnail subset.<br />

Galleries are always fun to create, <strong>and</strong> coming up <strong>with</strong> new <strong>and</strong> flashier solutions for them is also enjoyable.<br />

I hope that by learning some of the tricks presented in this chapter you feel confident to play around <strong>with</strong> them <strong>and</strong><br />

come up <strong>with</strong> your own gallery ideas.<br />

www.it-ebooks.info<br />

319

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!