如何使用按钮更改弹出窗口的背景颜色

时间:2021-01-28 14:06:37

标签: javascript html

我尝试制作一个按钮来更改弹出窗口的背景颜色,这就是我所拥有的

let newWin = window.open("about:blank#Jacket_tabs", "hello", "width=712,height=534, fullscreen=yes, true");

此代码不运行

newWin.document.write("<button type='button' onclick='myFunction()'>Change Color</button><script>function myFunction(){   document.body.style.backgroundColor= 'black';}</script>")

这就是一切,但没有按钮

newWin.document.write("<body style='background-color:lack;'></body");

问题是你不能使用 " " 2 次它不起作用。我尝试使用 '' 但它没有用

这是代码

https://code.sololearn.com/W9a17a4a21A2

0 个答案:

没有答案