Javascript document.title和docuemnt.write不能同时工作

Javascript document.title和docuemnt.write不能同时工作,javascript,jquery,html,Javascript,Jquery,Html,我想点击一个按钮打开一个新窗口。它已成功打开,但我无法同时写入数据和设置标题 有人知道吗 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title And Data Both</title> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></s

我想点击一个按钮打开一个新窗口。它已成功打开,但我无法同时写入数据和设置标题

有人知道吗

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title And Data Both</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
   $(document).ready(function(){
       $("button").click(function(){
            var filename ="console.log";
           var newwin = window.open("","","width=200,height=100");


            newwin.document.title="Title";            
            newwin.document.write("<h1>XXXX</h1>");
       });
   });
</script>
</head>
<body>
<button type="button">Get Substring</button>
</body>
</html>

标题和数据
$(文档).ready(函数(){
$(“按钮”)。单击(函数(){
var filename=“console.log”;
var newwin=window.open(“,”,“宽度=200,高度=100”);
newwin.document.title=“title”;
newwin.document.write(“XXXX”);
});
});
获取子字符串
document.write()覆盖所有现有HTML(包括标题)。 有一种方法可以做到这一点,那就是在写作之后设置标题


标题和数据
$(文档).ready(函数(){
$(“按钮”)。单击(函数(){
var filename=“console.log”;
var newwin=window.open(“,”,“宽度=200,高度=100”);
newwin.document.write(“XXXX”);
newwin.document.title=“title”;
});
});
获取子字符串
document.write()覆盖所有现有HTML(包括标题)。 有一种方法可以做到这一点,那就是在写作之后设置标题


标题和数据
$(文档).ready(函数(){
$(“按钮”)。单击(函数(){
var filename=“console.log”;
var newwin=window.open(“,”,“宽度=200,高度=100”);
newwin.document.write(“XXXX”);
newwin.document.title=“title”;
});
});
获取子字符串

您正在使用哪个浏览器?
document.write()
覆盖窗口的内容。在后面设置标题(或使用适当的HTML并在头部添加标题标记)。我使用的是Chrome浏览器。
文档。title
更改
元素
document.write
删除所有内容(包括标题标签)。您使用的浏览器是哪个?
document.write()
覆盖窗口的内容。在后面设置标题(或使用适当的HTML并在头部添加标题标记)。我使用的是Chrome浏览器。
文档。title
更改
元素<代码>文档。写入删除所有内容(包括标题标签)