可以将<script><//script>内容放入<body>中吗?
<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
</head>
<body>
<script type="text/javascript">
function openWindow(){
var w=confirm("打开网页吗?");
if(w==true)
{var website=prompt("输入网址","http://www.imooc.com");
if (website!=false)
{window.open(website,'_blank','width=400,height=500,menubar=no,toolbar=no');}
else{alert("结束!");}
}
else{alert("结束!");}
}
</script>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
这样对不对呢?和在<head>中的区别是什么?