Javascript Tutorial: go deep into the PopUp object
The company asked me to add the prompt function on an office system. I have studied for a long time and tried many methods. use window. the prompt is displayed on a regular basis, but the customer is impatient to say that the pop-up window is too complicated. so I came up with the CreatePopup () method, but the problem is that since it is an office system, we need to consider compatibility issues, not the web browser, we have to consider the issues of IE 5.0 and IE 5.5. IE 5.0 does not support the CreatePopup method. You can only use Window. open to simulate. so I wrote two prompt box implementation methods using the browser version to determine and use the corresponding method. the prompt box has the same effect as that of MSN, But windows is used in IE 5.0. open to replace CreatePopup ().
Window. open MSN prompt box effect can only be seen in versions earlier than IE 5.0.
So much nonsense, let's look at the Popup object.
A popup object is a window without borders. It is placed in any window and must be controlled by a script. Through javascript, we can control the position of its appearance or write content into it. note: If the content exceeds the display range after the size is fixed, no scroll bar will appear. If you click it outside, it will automatically disappear. it uses the parent attribute to access its window.
1. Syntax
Create a popup object;
Var popupobj = window. createPopup ()
Access the attributes and methods of the popup object from the document in the create pop-up window:
Popupobj. property | method ([parameters])
2. Attributes
Document
Popupobject.doc ument
This attribute is the only entry for creating scripts to Popup objects. For example
Popobj.doc ument. body. style. border = "solid 1px #000000", we can set a general border for the pop-up window.
IsOpen
Popupobject. isOpen
Return Value: Boolean
If the window is visible, isOpen returns True; otherwise, it is False.
3. Method
Hide ()
Popupobject. hide ()
Note: If you want to add a close button in the pop-up window, you can do this: if the name of the pop-up window is popobj, you need to use parent. popobj. hide () to close yourself
Show (left, top, width, height [, positioningElementRef])
The default value is left. The top value is 0, indicating the coordinates of the display area. The width and height indicate the width and height of the window.
The above is the Javascript Tutorial: go deep into the content of the PopUp object. For more related articles, please follow the PHP Chinese Network (www.php1.cn )!