In this example, two pages are created, as shown in Figure 1. Index.html is the page displayed in the sub-window, and the page named firstpage.html contains a link to open Index.html in the sub-window. When the link is clicked, index.html opens in a child window. You can directly click the "Close" link in the sub-window to close the sub-window, or you can ignore it. The sub-window will automatically close after 15 seconds.
Figure 1 The specific operation of the browser pop-up page
is as follows:
1. Generate a Smlple folder in the local site.
2. In the Smlple folder, generate files named Index.html and firstpage.html.
3. Double-click Index.html to open the document and enter the design view window of the document.
4. Click the menu View/Head Content to display the head area of the document.
5. Click the document header pane in the Design view window. Select the menu Insert/Invisible Tags/Script to open the Inset Script dialog box. As shown in Figure 2, select the JavaScript option in the Language drop-down list box and enter "setTimeout("self.close()", 15000)" in the Coctento text box. Click the OK button to complete the script that automatically closes the child window 15 seconds after inserting it into the document header. In the code, 15000 means 15000 milliseconds, which is 15 seconds. You can also modify it to the number of milliseconds you need as needed.
Figure 2 Set time
6. Enter the word "Close" in the document window, enter "###" in the Link text box on the properties panel, and set it to an empty link.
7. On the Quick Tag Editor at the left end of the status bar, click the Tag button. Select the "Close" link, and then press the Ctrl+T key combination to open the Quick Tag Editor and enter the edit tag mode of the Quick Tag Editor. Then enter "onclick="selfclose()"" before ">". As shown in Figure 3, after the settings are completed, click the OK button to confirm the operation. In this way, after Index.html is opened as a sub-window, clicking the link can immediately close the sub-window.
Figure 3 Set time
8. Save the Index.html file and exit the Dremweaver window of index.html.
9. Now start designing the fristpage.html page. In the Smlple folder of the local site, double-click fristpage.html to open the document and enter the design view window of the document.
10. Enter the words "Click here to open a subwindow that will automatically close" in the document. Then enter "###" in the Link text box on the properties panel to set it as an empty link.
11. You can set the Index.html window to open when the link is clicked by applying the Open Browser Window behavior to the link, but a more convenient method is to use the Quick Identity Editor. To do this, first place the insertion point into the link, then click the Identity button on the Identity Selector at the left end of the status bar to select the entire link. Then press the Ctrl+T key combination to open the Quick Tag Editor and enter the edit logo mode of the Quick Tag Editor. Then enter "onclick="window.open('index.html',null','width=200px, height=200px')" before ">" (as shown in Figure 4). After setting is completed, press the Enter key to confirm the operation.
Figure 4 Setting the link to open when clicked
12. The above operations complete the settings for this example. You can click the menu and use File/save to save your work. Then press the F12 key to preview the page effect in the browser.