猿问

JavaScript close()方法无效?

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>window.open测试</title>

<script>

function openWin(){

    myWindow=window.open(",","my","width=400,height=400,top=50,left=10");

    myWindow.document.write("<p>这是'我的窗口");

    myWindow.document.write("<br>ScreenLeft: " + myWindow.screenLeft);

    myWindow.document.write("<br>ScreenTop: " + myWindow.screenTop + "</p>");

}


function close(){

    myWindow.close();

}

</script>

</head>

<body> 

<input type="button" value="打开 '我的窗口'" onclick="openWin()">

<input type="button" value="关闭窗口" onclick="close()">


</body>

不知道为什么会无法关闭标签页,百度了下其他close方法也不行,求解

烙印99
浏览 1034回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答