使用javascript设置HTML文本颜色和大小 [英] set html text color and size using javascript
本文介绍了使用javascript设置HTML文本颜色和大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< div id =MonitorInformation>正在连接...等待< / div>
预先感谢,
George
解决方案
var elem = document.getElementById(MonitorInformation);
elem.innerHTML =设置不同的HTML内容;
elem .style.color =Red;
elem.style.fontSize =large;
Suppose I have the following line of code in html, how to set the text color and size inside "MonitorInformation" DIV element in a programming way using Javascript in an easy way? Sorry for my stupid, I figured a long time but cannot figure out. :-(
<div id="MonitorInformation">Connecting...wait</div>
thanks in advance, George
解决方案
var elem = document.getElementById("MonitorInformation");
elem.innerHTML = "Setting different HTML content";
elem.style.color = "Red";
elem.style.fontSize = "large";
这篇关于使用javascript设置HTML文本颜色和大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文