HTMLDocument.style detail 发表于 2024-12-23 更新于 2024-12-24 分类于 discover 阅读次数: HTMLDocument.style is point to DOM 1234567891011<style>.d{ color: red;}</style><div class="d">DOM</div><script>console.log(document.querySelector('.d').style.color)// 空</script> 1234567891011<style>.d{ color: red;}</style><div class="d" style="color: green;">DOM</div><script>console.log(document.querySelector('.d').style.color)// green</script> So it mean HTMLDocument.style just refer html label. Even though you have written the color in css file but not written in html label, it just print ‘’ in terminal. 請打賞支待一下. 打赏 微信支付 支付宝