js打开新的标签页并修改其内容

在js里:

nwin = window.open(''); //新开空白标签页
nwin.document.write("<p>在新的标签页内,写入html标签</p>"); //将内容写入新标签页
nwin.focus(); //获取焦点
nwin.document.title="新页面的标题"; 

注意,不需要var nwin,直接写nwin就可以了,当初我就在这里踩的坑。TAT

效果:

其他的可以参考 https://blog.csdn.net/wsh900221/article/details/80757837 说的很详细。

猜你喜欢

转载自blog.csdn.net/qq_34075464/article/details/85003787