我想改变网页中像素的颜色。 我将使用 JavaScript 或 vbscript。
我尝试用 1x1 大小的单元格制作表格并为它们着色,但速度非常慢。 我需要一种更快的方法。
为像素着色的成本最低的方法是什么?
最佳答案
给你...
CSS
#myDot {
position:fixed; /* always stays there even when other elements change */
width:1px; /* change if you need a bigger dot */
height:1px; /* change if you need a bigger dot */
}
HTML
<div id="myDot"></div> <!-- Can be span also -->
JS
document.getElementById("myDot").style.left = 100; // x position
document.getElementById("myDot").style.top = 100; // y position
document.getElementById("myDot").style.background = "red"; // color
关于javascript - 如何用脚本改变一个像素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14232000/