Code
< Html >
< Head >
< Meta HTTP-equiv = "Content-Type" Content = "Text/html; charset = gb2312" >
< Title > Popup </ Title >
< Script Type = "Text/JavaScript" SRC = "JS/Popup. js" > </ Script >
< Script Type = "Text/JavaScript" SRC = "JS/popupclass. js" > </ Script >
</ Head >
< Body >
< P Align = "Center" >
< Input Type = "Button" Value = "Open Baidu" Onclick = "Showiframe ('Baidu ', 'HTTP: // www.baidu.com', 800,450 )" > < BR >
< Input Type = "Button" Value = "HTML string" Onclick = "Showhtmlstring ('string', '<B> hello, popwin', 400,200 )" > < BR >
< Input Type = "Button" Value = "Information prompt box" Onclick = "Showalert ('prompt box ',' <B> hello, popwin', 200,100 )" > < BR >
< Input Type = "Button" Value = "Confirm" Onclick = "Showconfirm ('confirmed', 'delete', 'button4','', 80 )" >
</ P >
</ Body >
</ Html >
The call is relatively simple. The scripts are Popup. js and popupclass. js. Popupclass is the original Js of Baidu Network (in fact, it is not exactly the same, because I think it is difficult to see the close icon in the pop-up window, so I changed it ~~~~) Popup. JS is a call method that I extract based on its JS file. Now I will introduce Popup. js. For more information about popupclass. JS, see the article on Baidu space in taohua xiaoshe.ArticleBaidu space popup effect analysis. Basically, I simply encapsulated it according to his ideas.
Showiframe (title, contenturl, width, height)
- Title in the pop-up window
- Page path of the contenturl pop-up window
- Width
- Height the height of the pop-up window
Showhtmlstring (title, strhtml, width, height)
- Title in the pop-up window
- Strhtml htmlCode
- Width
- Height the height of the pop-up window
Showalert (title, alertcon, width, height)
- Title
- Content of the alertcon pop-up dialog box
- Width
- Height dialog box height
Showconfirm (title, confirmcon, ID, STR, width, height)
- Title pop-up confirmation box title
- Confirm pop-up confirmation box content
- ID: the ID of the control to trigger the event after you click OK.
- STR value (retained)
- Width
- Height pop-up to confirm the height of the mine
Then, how can we close the pop-up window? Of course, click the X in the upper right corner. If you use code, you only need to call a function parent. closepop.
If the pop-up window of the Framework is displayed on the parent page, you only need to add a parent before the function. For example, parent. showiframe ('Baidu ', 'HTTP: // www.baidu.com', 500,200 ).
/Files/njnudt/popup.rar