Dreamweaver CS4 Resources
|
Write and edit scripts in Design view
You
can work with client-side JavaScripts and VBScripts in both Code
and Design views, in the following ways:
Write a JavaScript or VBScript script
for your page without leaving Design view.
Create a link in your document to
an external script file without leaving Design view.
Edit a script
without leaving Design view.
Before starting, select View >
Visual Aids > Invisible Elements to ensure that script
markers appear on the page.
Write a client-side script- Place
the insertion point where you want the script.
- Select Insert > HTML > Script
Objects > Script.
- Select the scripting language from the Language pop‑up
menu.
If you are using JavaScript and are unsure of the version,
select JavaScript rather than JavaScript1.1 or JavaScript1.2.
- Type or paste your script code into the Content box.
You don’t need to include the opening and closing script tags.
- Type or paste HTML code into the No Script box. Browsers
that don’t support the chosen scripting language display this code
instead of running the script.
- Click OK.
Link to an external script file- Place the insertion point where you
want the script.
- Select Insert > HTML > Script
Objects > Script.
- Click OK without typing anything in the Content box.
- Select the script marker in Design view of the Document
window.
- In the Property inspector, click the folder icon and
browse to and select the external script file, or type the filename
in the Source box.
Edit a script- Select the script marker.
- In the Property inspector, click the Edit button.
The script appears in the Script Properties dialog box.
If
you linked to an external script file, the file opens in Code view,
where you can make your edits.
Note: If there is code between
the script tags, the Script Properties dialog box opens even if
there is also a link to an external script file.
- In the Language box, specify either JavaScript or VBScript
as the language of the script.
- In the Type pop‑up menu, specify the type of script,
either client-side or server-side.
- (Optional) In the Source box, specify an externally linked
script file.
Click the folder icon or
the Browse button to select a file, or type the path.
- Edit the script, and click OK.
Edit ASP server-side scripts in Design viewUse the ASP script Property inspector to
inspect and modify ASP server-side scripts in Design view.
- In Design view, select the server-language tag
visual icon.
- In the ASP script Property inspector, click the Edit
button.
- Edit the ASP server-side script, and click OK.
|