Javascript 尝试使用JS/JQuery在新窗口中编写时出现的问题
我对jQuery/JavaScript的加载有问题,我想在单击包含保存在变量Javascript 尝试使用JS/JQuery在新窗口中编写时出现的问题,javascript,jquery,Javascript,Jquery,我对jQuery/JavaScript的加载有问题,我想在单击包含保存在变量event.target.dataset.serial中的特定数据的按钮后尝试在新窗口中写入,但我不知道为什么不能在新窗口中写入该数据 bindNewWindow(处理程序){ $('.container p按钮')。单击((事件)=>{ 让位置=this.newWindow.length; this.newWindow[position]=window.open('window.html',position,“宽=11
event.target.dataset.serial
中的特定数据的按钮后尝试在新窗口中写入,但我不知道为什么不能在新窗口中写入该数据
bindNewWindow(处理程序){
$('.container p按钮')。单击((事件)=>{
让位置=this.newWindow.length;
this.newWindow[position]=window.open('window.html',position,“宽=1100,高=600,顶=250,左=250,标题栏=yes,工具栏=no,菜单栏=no,位置=yes”);
this.newWindow[position].addEventListener('DOMContentLoaded',()=>{
处理程序(event.target.dataset.serial)
});
this.newWindow[position].focus();
event.preventDefault();
event.stopPropagation();
});
}
MostrarImagenVentanaNueva(图片){
//生存的条件
让位置=this.newWindow.length-1;
让main=$(this.newWindow[position].document).find('main');
main.empty();
让容器=$(`
${image.getTitle()}
${image.getDescription()}
${image.getCoords()}
`);
主。附加(容器);
this.newWindow[position].document.body.scrollIntoView();
}
控制台中的错误?你被允许访问“main”吗?window.HTML的HTML是什么?参数也可以是“width=1100,height=600,top=250,left=250,titlebar,location”
并更改append to.HTML,然后您可以删除.emptywindow.HTML它是新窗口的框架,包含一些元素,如navbar,。。main它是window.html中我想放数据的标记的名称。控制台中没有任何错误,只是当我打开新窗口时,数据没有出现在新窗口中