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