[英]How can close the tab when open the new tab in same browser?
我已經在瀏覽器選項卡中打開了一個網站。 現在,當我從該網站打開一個新標簽時,我想關閉該瀏覽器中的第一個標簽。
使用此腳本
<html>
<head>
<script type="text/javascript">
function click1() {
window.open("http://127.0.0.1/");
window.open("http://127.0.0.1/wordpress/?page_id=2");
}
function close1() {
var c="http://127.0.0.1/";
c.close();
}
function newwin (urllink) {
newwindow = window.open( urllink ,'newwin')
}
</script>
</head>
<body>
<a href="javascript:newwin('http://www.bbc.co.uk')">bbc</a><br>
<a href="javascript:newwin('http://www.google.co.uk')">google</a>
<form>
<input type="button" value="close me!!" onClick="close1()"/>
<input type="button" value="Close" onClick="window.newwindow.close()">
<form>
</body>
</html>
請嘗試這個
<script type="text/javascript">
function newwin (urllink) {
newwindow = window.open( urllink ,'newwin')
}
</script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.