Common Methods for Window objects

Source: Internet
Author: User

1 <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">2 <HTMLxmlns= "http://www.w3.org/1999/xhtml">3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />5 <title>Window Object method</title>6 <Script>7 window.onload=function(){8 //Open a new window and assign a value to a variable9 Subwindow=window.open ("http://www.baidu.com","name","height=200,width=300");//I didn't add Var in front of him, he became a global variable. Ten SetTimeout ('Location ()',1800); One SetTimeout ('Closew ();',4000);//timer, after 2 seconds, execute the CLOSEW function A } - functionClosew () { - subwindow.close (); the     //the alert () method is also a method of the Window object, except that window can omit the - Window.alert ('pop up a prompt box'); -     varBOOL=Window.confirm ('Are you sure you want to delete this piece of data? ');//Confirm method, user Click is put back ture, click Cancel to return False.  -     if(BOOL) + Alert ('your data is deleted successfully! '); -     Else + Alert ('you have canceled data removal! '); A     //Implement page Jumps at     varAnswer=Window.prompt ("where are you reading?",'Ahnu');//returns a null or user-entered string value (NOT null) -     if(Answer) - alert (answer); -     Else - Alert ('The string you entered is empty'); -      in      - } to functionLocation () { + SubWindow.location.href="http://www.anshida.net"; - } the </Script> * </Head> $ <Body>Panax Notoginseng <spanID= "E">Hehe</span> - </Body> the </HTML>

Web instance: Please point me

Common Methods for Window objects

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.