Small Window University question-Playbox pop-up window (3)

Source: Internet
Author: User

Open the file 1.htmin the main window, and pop up the window page.html at the same time]

Add the following code to the <Script language = "javascript"> "〉
<〈! --
Function openwin (){
Window. open ("page.html", "", "width = 200, height = 200 ")
}
// --> //--〉
</Script> 〉

Join the <body> area:
<A href = "1.htm" onclick =" openwin () "> open </a>.

[6. timed close control for the pop-up window]

Next we will make some control over the pop-up window, and the effect will be better. If we add the field code to the page that pops up (the page is added to the HTML of page.html, not the page, otherwise...), will it be cool to enable it to be automatically disabled in 10 seconds?

First, add the following code to the
<Script language = "JavaScript"> "〉
Function closeit (){
SetTimeout ("self. close ()", 10000) // millisecond
}
</Script> 〉
  
Then, use the "body onload =" closeit () "> statement to replace the original" BODY "sentence in page.html. (Do not forget to write this sentence! The function of this statement is to call the code for closing the window. The window will be closed in 10 seconds .)

7. Add a close button in the pop-up window]
<FORM> 〉
<Input type = 'button 'value = 'close 'onclick = 'window. close ()'> ()'〉
</FORM> 〉
  
Now it's more perfect!
  
[8. pop-up window contained in the Content-one page and two windows]
  
The preceding example contains two windows: one is the main window and the other is the small window that appears. Through the example below, you can complete the above effect on a page.

<Html> 〉
<Head> 〉
<Scrit language = "JavaScript"> "〉
Function openwin ()
{
OpenWindow = window. open ("", "newwin", "height = 250,
Width = 250, toolbar = no, scrollbars = "+ scroll +", menubar = no ");
// Write a row
Opendeskdoc ument. write ("<TITLE> example </TITLE> 〉")
Openmediaworkflow Doc ument. write ("<body bgcolor = # ffffff> 〉")
Openmediaworkflow Doc ument. write ("Openmediaworkflow Doc ument. write ("New window opened! ")
Openmediaworkflow Doc ument. write ("</BODY> 〉")
Openmediaworkflow Doc ument. write ("</HTML> 〉")
Openmediaworkflow Doc ument. close ()
}
</SCRIPT> 〉
</Head> 〉
<Body> 〉
<A href = "#" onclick = "openwin ()"> open a window </a> 〉
<Input type = "button" onclick = "openwin ()" value = "open window"> "〉
</Body> 〉
</Html> 〉

Do you think the code in openmediaworkflow Doc ument. write () is not standard HTML? You only need to write more rows according to the format. An error occurs when you add one or more labels. Remember to end with opentracing upload Doc ument. close.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.