ONLINEGRAPHICPROOFING.COM

contact proof printer - www.onlinegraphicproofing.com

Menu


display a Close Window confirmation dialog. Because no behavior exists for this action, we'll use the Call JavaScript behavior to write


it ourselves. Begin by following these steps: 1. With your cursor in the page, insert a new Button form object by clicking the Button icon from the Forms category of the Insert bar. 2. When the Add Form Tag dialog appears, click No. 3. With the Button form object selected, change the Action to None so that the button doesn't try to submit or reset the form when it's clicked. You can also change the Label to read anything you'd like. I'll changed my button's label to say Close Window. 4. With the Close Button selected, choose the Call JavaScript behavior from the Add (+) menu in the Behaviors palette. The Call JavaScript dialog appears. 5. In the dialog, enter the code window.close(); (including the final semicolon). 6. Click OK. 7. If the selected event isn't onClick, change it to the onClick event now. Save your work and preview the results in Internet Explorer by choosing the Preview in Browser option from the Document bar (or by pressing F12). You'll notice that when you click the Close button in Internet Explorer, a Close dialog appears, asking whether you want to close the browser window (see Figure 10.8). Figure 10.8. The Close Window dialog asks whether you want to close the existing browser window.   As you can see, the Call JavaScript behavior allows you to quickly write inline JavaScript functions that don't already exist as behaviors without having to switch to Code view. Change Property You can use the Change Property behavior as a way of changing the physical characteristics of a particular object. For instance, when a button is clicked, you might want to set the background color of a layer, set the text value of a text box, and so on. For our example, we'll use the Change Property behavior to add text to a text box dynamically when a button is clicked. You can do this by following these steps: 1. With your cursor in the page, insert a new Button form object by clicking the Button icon from the Forms category of the Insert bar. 2. When the Add Form Tag dialog appears, click Yes. 3. With the Button form object selected, change the Action to None so that the button doesn't try to submit or reset the form when it's clicked. You can also change the Label to read anything you'd like. I'll change mine to say Set Text. 4. Now add a Text Field form object to the Button by clicking the Text Field icon from the Forms category of the Insert bar. 5. With the Set Text button selected, choose the Change Property behavior from the Add (+) menu in the Behaviors panel. The Change Property dialog appears. 6. In the dialog, select the INPUT/TEXT option from the Type of Object menu, choose the text "textfield" in form "form1" option from the Named Object menu, choose the value option from the Select menu in the Property radio group, and type the text Hello World in the New Value text box. When you finish, the results will look similar to Figure 10.9. Figure 10.9. Customize the Change Property dialog. 7. Click OK. 8. If the selected event isn't onClick, change it to onClick now. Save your work and preview the results in the browser by choosing the Preview in Browser option from the Document bar (or by pressing F12). You'll notice that when you click the Set Text button in the browser window, the text Hello World is written into the accompanying text box (see Figure 10.10).