How to Countdown With a Dreamweaver Clock

By Jim Campbell

To add a countdown timer in Dreamweaver, you must add some JavaScript code to the Web page. Dreamweaver has a JavaScript insertion window that helps you insert a block of JavaScript code without manually setting up the countdown timer directly in the Web page.

Step 1

Open the Dreamweaver software. Open your Dreamweaver Web project to load all the website files.

Step 2

Double-click the file in which you want to create a timer. Click the Dreamweaver "Insert" menu item and select "HTML." Click the "Script Objects" submenu item and click "Script" to open the script window.

Step 3

Type the following JavaScript code into the "Content" text box in the opened JavaScript window:

var timeout=setTimeout("myfunction()",4000); function myfunction() { alert ("Time up"); }

In this example, the function "myfunction" executes after four seconds. The countdown timer is set in milliseconds. The first parameter is the function that executes when the time is reached after the user opens the Web browser.

Step 4

Click "JavaScript" in the "Language" drop-down. Click "OK" to insert the script into the file. Save the file changes and open the file in a Web browser to test the new countdown timer.

×