You can also drag the jsTrace debugger window around to reposition it and grab the little triangle in the
lower-right corner to resize it. You can also close it altogether by clicking the X in the upper-right corner. If
you have cookies enabled, the size and position of the debugger will be maintained as well. So you can tuck
it out of the way and won??™t have to move it each time you refresh.
2. Of course, you still haven??™t set up FAQ.initialize() to actually run yet, so you should
do that as well. At the bottom of faq.js, add the following just after the closing brace
of the object:
if( typeof( Prototype ) != 'undefined' &&
typeof( fx ) != 'undefined' &&
document.getElementsByTagName( 'dl' ) ){
addDOMLoadEvent( function(){ FAQ.initialize(); } );
}
This sets FAQ.initialize() to run as soon as the DOM is loaded, but only if Prototype
and Moo.fx are both defined and the document contains one or more dl elements.
After all, the script will throw a lot of errors without the libraries, and there??™s no reason
to run it if there are no dl elements on the page.
3. If you save the file and refresh your browser, you should see the jsTrace window shown
in Figure 8-5.
nNote You??™ll be using trace() throughout this script so you can pause at just about any time to refresh
your browser and see that everything is working as expected.
CHAPTER 8 n CASE STUDY: FAQ FACELIFT 176
Figure 8-5.
Pages:
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250