- 用js设置div的背景色:document.getElementById(‘div2’).style.backgroundColor=’#ff0000’;
- 用js设置字体颜色:
var color = new Array(“red”,”orange”,”yellow”,”green”,”blue”,”indigo”,”purple”);
var message = new Array(“红”,”橙”,”黄”,”绿”,”蓝”,”靛”,”紫”);
document.getElementById(“color”).style.color = color[i]; - 如何在js中设置文字的行高:line_height::document.getElementById(“div1”).style.lineHeight=”2”;
html5编程之用js设置背景颜色、字体颜色和行高
最新推荐文章于 2024-04-14 16:28:00 发布