Moving JavaScript to an external file

This exercise demonstrates how to use the JavaScript Extractor using spry_selector.html from the preceding section. 1. Because the JavaScript Extractor cannot restore JavaScript once it has been removed from a page, it's always a good idea to create a new copy of the file that you want to work on. Save spry_selector.html from the previous exercise or from examples ch08 as spry_unobtrusive.html in workfiles ch08. 2. Close the original file and work with spry_unobtrusive.html. 3. Select Commands...

Displaying a random quotation

The Stroll Along the Thames page you've used in several chapters has a pull quote with a quotation from Samuel Johnson. In this exercise, you'll replace that static quotation with one drawn at random from the authors and quotations tables. This demonstrates three useful techniques how to join multiple tables, randomize the order of recordset results, and limit the number of results. You can use an existing version of the page, as long as it has a .php extension. However, you will probably find...

Creating a Spry select list

Creating a Spry select list uses the same technique as described earlier in the chapter in Displaying a data set as a list. It involves the following three steps 1. Create the data set that will be used in the Spry select list. 2. Insert a Spry region bound to the data set. 3. Insert a Spry repeat list, and set the options for a Spry select list. The data container for the Spry select list already exists in gallery_select.php, so you're ready to start.

Using a Spry select list to change page content

Unlike a normal lt select gt element, when you insert a Spry select list into a page, Dreamweaver doesn't prompt you to insert lt form gt tags at the same time. This is because you can use Spry to respond to changes in the selected option without the need to submit a form. All that's necessary is to add an onchange event handler to the select list. This dispatches details of the selected item to other Spry elements, updating the page in the same way as clicking a row in a Spry table. I'll...

Creating a repeating region 1

As with templates, repeating regions are not automatically editable, so you will normally apply an editable region first and then convert it to a repeating region. To convert the whole of an editable region into a repeating region, select the turquoise tab at the top left of the region and click the Create Repeating Region button on the InContext Editing tab see Figure 13-15 of the Insert bar, or use the menu option Insert gt InContext Editing gt Create Repeating Region. This adds the ice...

Using version control with Subversion

Some form of version control is standard in team environments, but it's something that individual developers either don't know about or tend to treat like regular backups of hard disks you know you ought to do it, but never quite get around to it. If you have ever made changes to a file and wished you could roll back to the original, you need version control. In one respect, version control acts as a database, storing project files at different stages of development. Instead of overwriting the...

Managing Dreamweaver sites

To change any settings in your site definition, select Manage Sites from the Site menu to open the Manage Sites dialog box see Figure 2-14 . Select the name of the site that you want to change and click Edit. This reopens the Site Definition dialog box, ready for you to update the settings. If you're feeling really impatient, though, the quickest way of opening the Site Definition dialog box is to double-click the site's name in the drop-down menu at the top left of the Files panel. The Manage...

Inspecting dynamically generated code with Live Code

The resurgence of interest in JavaScript stemming from the popularity of Ajax and libraries such as jQuery and Spry has undoubtedly brought benefits. JavaScript sees a web page in terms of a hierarchical structure known as the Document Object Model DOM , which can be manipulated to produce dynamic effects, including rollovers and sliding panels, and to rearrange the content of the page. The difficulty, from the developer's perspective, is that JavaScript manipulates the DOM behind the scenes...