扫码关注官方订阅号
因为document.write会重写整个html的内容原先是这样的而你点击之后,页面源码变成了这样
document.write
html
也就是只有amo里面的内容了你的style样式都被覆盖替换掉了
amo
style
document.write();把head里的style都写掉了。。
document.write();
head
因为用了,document.write,document.write会清除掉所有的doucment的内容,因此你写的style也会被清除掉,你用“审元素”看一下,会发现dom里只有你write的元素了。
document.write 把原来的网页覆盖了 所以你写的style也就不存在了
你直接用 document.write 把原文档都覆盖 了,你打开你的页面看看,
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
因为


document.write会重写整个html的内容原先是这样的
而你点击之后,页面源码变成了这样
也就是只有
amo里面的内容了你的
style样式都被覆盖替换掉了document.write();把head里的style都写掉了。。因为用了,
document.write,document.write会清除掉所有的doucment的内容,因此你写的style也会被清除掉,你用“审元素”看一下,会发现dom里只有你write的元素了。document.write 把原来的网页覆盖了 所以你写的style也就不存在了
你直接用 document.write 把原文档都覆盖 了,你打开你的页面看看,