我想在 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/