Javascript BASIC Programming Exercise One

Source: Internet
Author: User

Javascript Basic Interactive programming, this exercise combines function name (), onclick time, prompt input window, window.open and Confirm window,

Task

1. Pop-up confirmation box when new window opens, open

Use if to determine whether the confirmation box clicked OK, such as clicking the Popup Input dialog box, otherwise there is no action.

2, through the Input dialog box, determine the open URL, the default is http://www.baidu.com/

3, open the window requirements, 800 pixels wide, 600 pixels high, no menu bar, no toolbar.

1<! DOCTYPE html>234<title>NewDocument </title>5<meta http-equiv="Content-type"Content="text/html; CHARSET=GBK"/>6<script type="Text/javascript">7 function Openwindow () {8             varMycon=confirm ("Would you like to open");//A new window opens with a confirmation box open9             if(mycon==true){Ten                 varMypro=prompt ("Please enter the URL you want to open");//by entering the dialog box, determine the open URL, which defaults tohttp://www.cnblogs.com/ One                 if(mypro!=NULL){ Awindow.open (Mypro,"_blank","Width=800,height=600,menubar=no,toolbar=no"); -}Else{ -window.open ("http://www.cnblogs.com/","_blank","Width=800,height=600,menubar=no,toolbar=no"); the                     //The open window requires a width of 800 pixels, a height of 600 pixels, no menu bar, no toolbars.  -                 } -             } -         } +</script> - +<body> A<input type="Button"Value="new window opens web site"onclick="Openwindow ()"/> at</body> -

Javascript BASIC Programming Exercise One

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.