<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function openWindow(){ var sure=confirm("是否打开?"); if(sure==false){} else { var sure2=prompt("请输入您要打开的网址:","http://www.baidu.com"); if(sure2!=null){ window.open(sure2,"_blank","width=400,height=500,menubar=no,toobar=no"); } } } </script> </head> <body> <input type="button" value="新窗口打开网站" onclick="openWindow()" /> </body> </html>
//能有我的标准?
<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
// 新窗口打开时弹出确认框,是否打开
function openWindow(){
var mess;
mess=confirm('打开?');
if(mess){
next();
}
}
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
function next(){
var mywin;
var yesno;
yesno= prompt('打开的网址?','http://www.imooc.com/')
if(yesno){
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
mywin=window.open('http://www.imooc.com/','_blank','width=400,heght=500,menubar=no,toolbar=no')
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>