SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 1922 | Next

Joseph W. Lowery

"Dreamweaver CS3 Bible"

If it??™s not, the code alerts users to what??™s required:
function initializeUI() {
// uppercase the tag to make indexOf() searching easier
var theTag = dreamweaver.getBehaviorTag().toUpperCase();
if (theTag.indexOf(???IMG??™) != -1)) {
// Behavior UI initialization goes here
}
else {
alert(???This behavior requires you select an IMAGE to proceed.???);
}
}
Using the initializeUI() function to block access to a behavior is different from using the
canAcceptBehavior() function to block access. With the getBehaviorTag() technique,
the user is informed of the problem, rather than simply denied access.
The dreamweaver.getBehaviorElement() function
Another method to discover which tag is selected for the invoked behavior is the
getBehaviorElement() function. The major difference between this function and the
getBehaviorTag() function is that the former returns the DOM reference to the tag, whereas the latter
returns the tag itself. After you have the DOM reference of the behavior tag, you can uncover a terrific
amount of information about the tag and its attributes.
Like getBehaviorTag(), getBehaviorElement() is most often used to determine if the user has
selected an appropriate tag for the chosen behavior. If the tag is inappropriate, a helpful message can be displayed
to guide the user to a better option.


Pages:
1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934