![]() |
< Day Day Up > |
![]() |
10.6 Inserting JavaScriptAs Chapter 12 makes clear, Dreamweaver's Behaviors (prewritten JavaScript programs) let you add exciting interactive effects梞ouse rollovers, pop-up windows, animated layers, and so on梬ith very little effort. But they can't do everything: When you, the native JavaScript speaker, need to wade into the depths of JavaScript programming yourself, you'll find two entrances within Dreamweaver. The most straightforward approach, especially if you're already familiar with Java- Script programming, is to simply switch into Code view (Ctrl+` [Option-`]) and type away. Or, if you prefer, you can use Dreamweaver's Insert Script window to add your JavaScript code (see Figure 10-13). Unlike the Code view, the Insert Script window doesn't respond to the Tab key; if you're accustomed to indenting your code, you'll need to use spaces. You can also insert noscript information梩ext that appears if the Web browser doesn't understand JavaScript (noscript only works, however, if you're adding a script somewhere in the <body> of the page, not in the <head>.![]() To do so, click in either the head or body section of the page, and then choose Insert Just type your script into the Content section (no need to include <script> tags, as Dreamweaver handles that part) and then click OK. If you inserted the script in the body of the document, you'll see a small gold icon (indicating an invisible element on the page) to mark its location. NOTE
The JavaScript debugger that debuted in Dreamweaver 4 has been retired. Sorry. You can edit your script in Code view, of course. In Design view, select the script icon and then click Edit in the Property inspector. Dreamweaver also lets you open and work on external JavaScript files (.js files) right in Code view. The program doesn't try to interpret the file as an HTML page; it won't attempt to make any of the changes described in Section 10.1.1. You can just use the builtin text-editing capabilities of Code view to write your JavaScript programs.
|
![]() |
< Day Day Up > |
![]() |