Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: SV: How do you make a pixel in javascript


Message #1 by "Robert Nyman" <robert.nyman@c...> on Sun, 15 Dec 2002 19:56:56 +0100
	Actually, you could make a table of pixel-sized elements but be
aware that if you create a quite large table (like 400x300 pixels) the
browser would take quite a long time to render it.  Actually I've done 
this
before.  I had made a proof-of-conception and pedagogical "graphics in 
a
browser".

> -----Message d'origine-----
> De : Robert Nyman [mailto:robert.nyman@c...]
> Envoy=C3=A9 : dimanche 15 d=C3=A9cembre 2002 19:57
> =C3=80 : javascript
> Objet : [javascript] SV: How do you make a pixel in javascript
>
>
> There is no such thing in JavaScript.
> What you can do is to change src with images that are just one pixel
> big.
>
> Another option is to create an element and make it as small
> as possible,
> as in:
>
> <div id=3D"theDiv" style=3D"position:absolute; left:200px; top:10px;
> width:1px; height:1px; background-color:black; font-size:0px;"></div>
> NOTE: This DIV will be 1*1 pixel in Gecko-based browsers (Netscape 
6+,
> Phoenix etc), but 1*2 pixels in IE...
>
> Then you can change it's color with:
>
> document.getElementById("theDiv").style.backgroundColor =3D "navy";
>
>
> HTH,
> Robert
>

  Return to Index