javascript 入门之 新窗口打开网站

经过学习,我发现了部分代码值得收藏

 代码内容:制作新按钮,“新窗口打开网站” ,点击打开新窗口。

<!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 k_open;
var temp=confirm("是否要打开新的网页?");
if(temp)
{
k_open=prompt("请输入你要打开的网址:","http://www.imooc.com/");
window.open(k_open,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
}

</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>

posted @ 2017-05-06 14:48  Moucong  阅读(500)  评论(0编辑  收藏  举报