假设我在html中有下面这行代码,如何使用Javascript以一种简单的编程方式设置"MonitorInformation“DIV元素中的文本颜色和大小?为我的愚蠢道歉,我想了很久,但还是想不通。:-(
<div id="MonitorInformation">Connecting...wait</div>
先谢谢你,乔治
发布于 2009-07-27 15:30:09
var elem = document.getElementById("MonitorInformation");
elem.innerHTML = "Setting different HTML content";
elem.style.color = "Red";
elem.style.fontSize = "large";
发布于 2009-07-27 15:32:07
var myDiv = document.getElementById("MonitorInformation");
myDiv.style.fontSize = "11px";
myDiv.style.color = "blue";
发布于 2009-07-27 15:29:21
$("#MonitorInformation").text("Hello everyone").css("color", "red")
https://stackoverflow.com/questions/1188843
复制相似问题