為什么使用-self 這個參數,窗口沒有反應呢?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>window.open</title>
<script type="text/javascript">
? function Wopen(){
? ? ? var mymessage=confirm("點擊我,打開新窗口!");
? ? ? if (mymessage=true)
? ? ? {
? ? ? ? window.open('http://idcbgp.cn','_self','width=400,height=600,top=200,left=200,menubar=yes,toolbar=yes, status=yes,scrollbars=yes');?
? ? ? }
? ? ? else
? ? ? {
? ? ? ? ? alert(" 請重新來一遍~");
? ? ? }
? }?
</script>
</head>
<body>
? ? <input name="button" type="button" onClick="Wopen()" value="點擊我,打開新窗口!">
</body>
</html>
2019-05-14
可能是你的瀏覽器攔截了腳本
2019-01-17
_blank:在新窗口顯示目標網頁
_self:在當前窗口顯示目標網頁
_top:框架網頁中在上部窗口中顯示目標網頁