If, for example, you want to get some input from a visitor, you can use
JavaScript??™s built-in prompt() method like this:
result = prompt(???Whom shall I say is calling???™,??™??™)
When this code is triggered, a small dialog box appears with your query (here, ???Whom shall I say is
calling???™) and a blank space for an input string. The second argument in the prompt() method
enables you to include a default answer??”to leave it blank, just use an empty string (two single quotes with
nothing in between), as shown in the preceding code snippet.
You can use either single or double quotes in your Call JavaScript behavior; Dreamweaver
automatically adjusts for whichever you choose. I find it easier to use single quotes because
Dreamweaver translates double quotes into character entities; that is, ??? becomes ".
Naturally, you can use Call JavaScript to handle more complex chores as well. To call a specific custom
function that is already in the section of your page, just enter its name??”along with any necessary
arguments??”in the Call JavaScript dialog box, shown in Figure 12-4.
FIGURE 12-4
Trigger any JavaScript function by attaching a Call JavaScript behavior to an image or text.
NOTE NOTE
NOTE NOTE
408
Adding Advanced Design Features Part III
To use the Call JavaScript behavior, follow these steps:
1.
Pages:
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799