The Behaviors Api Functions - Adobe 38040334 - Dreamweaver CS3 User Manual

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

DREAMWEAVER CS3
236
Extending Dreamweaver
//-->
</script>
</head>
<body onLoad="checkBrowserBrand('netscaptecontent.htm','iecontent.htm')">
</body>
</html>
Testing the behavior
Finally, you can test the behavior.
To test the behavior:
View the file whichbrowser.htm in your browser.
Depending on which browser you are using, either iecontent.htm or netscapecontent.htm appears.

The behaviors API functions

Two behaviors API functions are required (
and
); the rest are optional.
applyBehavior()
behaviorFunction()
applyBehavior()
Description
This function inserts into the user's document an event handler that calls the function that
behaviorFunction()
inserts. The
function can also perform other edits on the user's document, but it must not delete
applyBehavior()
the object to which the behavior is being applied or the object that receives the action.
When you write the
function, you must decide how you want to edit the user's document. For
applyBehavior()
example, you might decide to insert some code inside script tags in the body of the document. You would do this
using the standard DOM editing APIs.
Arguments
uniqueName
The argument is a unique identifier among all instances of all behaviors in the user's document. Its format is
, where
is the name of the function that
inserts. This
functionNameInteger
functionName
behaviorFunction()
argument is useful if you insert a tag into the user's document and you want to assign a unique value to its
NAME
attribute.
Returns
Dreamweaver expects a string that contains the function call to be inserted in the user's document, usually after
accepting parameters from the user. If the
function determines that the user made an invalid
applyBehavior()
entry, the function can return an error string instead of the function call. If the string is empty (
),
return "";
Dreamweaver does not report an error; if the string is not empty and not a function call, Dreamweaver displays a
dialog box with the text Invalid input supplied for this behavior: and the string returned from
. If
applyBehavior()
the return value is
(
), Dreamweaver indicates that an error occurred but gives no specific information.
null
return;
Note: Quotation marks (
within the returned string must be preceded by a backslash (\) to avoid errors that the
"")
JavaScript interpreter reports.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents