<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
function NewWindow(){
window.open('http://www.imocc.com/','_blank','width=400,height=500,menubar=no,toolbar=no');
}
function openWindow(){
var mywindow=confirm("是否打开新窗口");
if (mywindow==true){
NewWindow();
}
else{
None;
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
<html> <head> <title>打开输入网页</title> <script type="text/javascript"> function openWeb(){ var getUrl; getUrl = prompt("请输入想要打开的网页地址:"); if(getUrl!=null){ window.open("http://"+getUrl,'_blank','width=300,height=200,menubar=no,toolbar=no, status=no,scrollbars=yes'); }else{ window.open('http://www.imooc.com','_blank','width=300,height=200,menubar=no,toolbar=no, status=no,scrollbars=yes'); } } </script> </head> <body> <input name="open" type="button" onclick="openWeb()" value="open"/> </body></html>
open的url不对啊!!!慕课网的url是“https://www.imooc.com”,采用的协议是HTTPS不是HTTP啊,所以你是打开不了“http://www.imooc.com”的!!!
<!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 mywin=prompt("是否打开新窗口?");
if(mywin=='确定'){
var winmy=window.open('http://www.imooc.com','width=400,height=500,menubar=no,toolbar=no');
}
else{
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
我是这么写的~.~