【发布时间】:2021-07-18 01:38:47
【问题描述】:
这是我的代码,我想在下面添加一张图片:
function createWindow() {
var myWindow = window.open("", "MsgWindow", "width=500,height=500");
myWindow.document.write("<h1>A test: </h1>" +
" <p> <b>Something bold: </b> text </p>");
// I want to add an image here (inside the widow) but I'm not sure how
}
【问题讨论】:
-
你试过
<img src="imagesource">吗? -
document.write 可以避免。您可以通过传递 url 在 window.open 中加载 html 文件
标签: javascript html image testing window