知识点
1、confirm(str) : if(确定)return true; return false;
2、prompt(str1, str2) : str1:固定文本,str2可输入文本,if(确定) return str2;return null;
3、window.open([URL],[窗口名称],[参数])
窗口名称:"_blank" "_self" "_top"
4、window.close()或者(窗口名).close
DOM文本:元素节点 ,属性节点,文本节点
<!DOCTYPE html>
<html>
<script type="text/javascript">
function openWindow()
{
var open=confirm("Do you want to open a new URL");
if(open)
{
var url=prompt("input the url","https://google.com");
if(pro!=null)
{
window.open(url,"_blank","top=10px,left=0px,width=400px,height=500px,toolbar=no,menubar=no,scrollbars=yes,status=yes");
}
else
{
alert("return");
}
}
else{
alert("return");
}
</script>
<body>
<input type="button" value="click" onClick= "openWindow()">
</body>
</html>
输入代码