84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
获取标签对象 obj
obj.style="background-color:red"
obj.style="backgroundColor:red"
这两种 那种 对 为啥都没反应???
关于js中修改css样式的问题?-PHP中文网问答-关于js中修改css样式的问题?-PHP中文网问答
围观一下哦,学习一下。
上述写法是混淆了CSS和DOM(具体说来就是javascript)这两个内容的语法规则。在CSS中,设置背景颜色可以在标签中的属性设为“background-color:red”。而在DOM中,设置背景颜色,需要用到属性sty.backgroundColor,将其设置为red,而且写法为:“obj.style.backgroundColor="red";”
关于js中修改css样式的问题?-PHP中文网问答-关于js中修改css样式的问题?-PHP中文网问答
围观一下哦,学习一下。
obj.style="background-color:red"
obj.style="backgroundColor:red"
上述写法是混淆了CSS和DOM(具体说来就是javascript)这两个内容的语法规则。在CSS中,设置背景颜色可以在标签中的属性设为“background-color:red”。而在DOM中,设置背景颜色,需要用到属性sty.backgroundColor,将其设置为red,而且写法为:“obj.style.backgroundColor="red";”