1. Trang chủ
  2. » Công Nghệ Thông Tin

JavaScript Bible, Gold Edition part 48 pot

10 207 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Nội dung

318 Part III ✦ Document Objects Reference that creates the window can assign values to the style property of the document in the pop-up window, as follows: myPopup.document.body.style.border = “solid 3px gray” Beware that the document object of a pop-up window may not implement the full flexibility you know about primary window document objects. For example, you are not allowed to assign a URL to the document.URL property in a pop-up window. Example on the CD-ROM Related Items: document object. isOpen Value: Boolean Read-Only NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility ✓ While a pop-up window is visible, its isOpen property returns true; otherwise the property returns false. Because any user action in the browser causes the pop-up to hide itself, the property is useful only for script statements that are run- ning on their own after the pop-up is made visible. Example on the CD-ROM Related Items: popup.show() method. Methods hide() show(left, top, width, height[, positioningElementRef]) Returns: Nothing. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility ✓ On the CD-ROM On the CD-ROM popupObject.hide() 319 Chapter 16 ✦ Window and Frame Objects After you have created a popup object with the window.createPopup() method and populated it with content, you must explicitly show the window via the show() method. If the window is hidden because a user clicked the main browser window somewhere, the show() method (and all its parameters) must be invoked again. To have a script hide the window, invoke the hide() method for the popup object. The first four parameters of the show() method are required and define the pixel location and size of the pop-up window. By default, the coordinate space for the left and top parameters is the video display. Thus, a left and top setting of zero places the pop-up in the upper-left corner of the video screen. But you can also define a different coordinate space by adding an optional fifth parameter. This parameter must be a reference to an element on the page. To confine the coordi- nate space to the content region of the browser window, specify the document.body object as the positioning element reference. Example (with Listing 16-49) on the CD-ROM Related Items: popup.isOpen property, window.createPopup() method. ✦✦✦ On the CD-ROM popupObject.hide() . <A NAME=” ”> </A> tag pair) becomes part of the URL after the hash mark. A location object’s hash property is the name of the anchor part of the current URL (which consists of the. dis- play that value as a string in your documents, you can safely pass all such poten- tially encoded strings through the JavaScript unescape() function. For example, if a URL to one of Giantco’s. document gets loaded into a window or frame. Though you may expect to find a method somewhere in JavaScript that contains a plain language “Go” or “Open” word (to simulate what you see in the browser

Ngày đăng: 06/07/2014, 06:20