gpt4 book ai didi

javascript - 在javascript中使用DOM设置文本阴影属性的值

转载 作者:太空宇宙 更新时间:2023-11-04 11:55:51 25 4
gpt4 key购买 nike

我想在 javascript 中使用 DOM 为 text-shadow 属性一个一个地赋值。text-shadow: h-shadow v-shadow blur-radius color|none|initial|inherit;

if(conf.hasOwnProperty('vshadow')) document.getElementById('p1').style.text.hshadow = 5px;
if(conf.hasOwnProperty('hshadow')) document.getElementById('p1').style.text.vshadow = 5px;
if(conf.hasOwnProperty('blurRadius')) document.getElementById('p1').style.text.blurradius = 5px;
if(conf.hasOwnProperty('shadowColor')) document.getElementById('p1').style.text.color = red;

我试过上面的代码,但是不行。有什么办法可以在 javascript 中使用 DOM

最佳答案

我不知道 DOM 对象 hshadow、vshadow、blurradius 是否真的存在,但正确的代码应该是 document.getElementById('p').style.textShadow = "5px 5px 5px 红色”

关于javascript - 在javascript中使用DOM设置文本阴影属性的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30255920/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com