I have this stylesheet:
.pixel{
position: absolute;
height: 10px;
width: 10px;
background-color: #ffcc00;
font-size: 0px;
}
And this javascript:
function drawpixel(x,y){
el = document.createElement('div');
el.setAttribute('class','pixel');
el.style.left = x;
el.style.top = y;
el.style.fontSize = "0px";
el.style.lineHeight = "0px";
document.body.appendChild(el);
}
function mover(event){
element = document.getElementById("coords");
element.innerHTML = event.clientX + " " + event.clientY;
drawpixel(event.clientX, event.clientY);
}
This allows me to draw using a div. But IE requires these 4 commented lines - for some reason it will not read class information?
Is there an easier way to “fix” it for IE, or do I pretty much just need to have these 4 lines?
thank
source
share