Click to See Complete Forum and Search --> : how 2 put pixel ...
lirlir
Jul 12th, 2000, 02:56 AM
how can i putpixel on an html page ?
is there a function that do so ?
i know that c have in its graphic lib the function "PutPixel(x,y,color)"
Ianpbaker
Jul 12th, 2000, 03:07 AM
Hi again lirlir
The only way I think you can do it is by using a div and It's style properties.
If you set up a div with a height of 1px and a width 1px. Then call a javascript function to set it's BGcolor and it's left and top position. The only problem is that you need to create a new div each time you want to put in a new pixel in.
If you need some code, give us a shout and I will try to build it.
I take it you want to use the code for tracking the mouse and when the user clicks the mouse, to put in a coloured pixel
Ian
lirlir
Jul 12th, 2000, 03:17 AM
hi lan (my net friend)
well i want to build a script that will
position a pixel or a message every time the user move the
mouse.
like a follow me(mouse) message.
the code that u sent me last time helped me to get the
x,y ,so i ll know where 2 print/put the message/pixel.
it would be very helpfull, if u have that code(puting a messag in a particular x,y), 2 send it 2 me.
thanks mate
Ianpbaker
Jul 12th, 2000, 03:20 AM
Hi lirlir
What you are asking isn't to hard I will try to knock it up on my lunch break.
Ian
lirlir
Jul 12th, 2000, 03:44 AM
i wrote this code it isn't working but it a start and i want to share it with u.
<STYLE>
SPAN.notice {background-color: #FFFFAA; font-size: 8pt; font-family: Arial; border: "1 solid"; border-top-color: "#EFEFEF"; border-left-color: "#EFEFEF"; border-right-color: "#C0C0C0"; border-bottom-color: "#C0C0C0"; width: 100; height: 15;}
</STYLE>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function document_onmousemove()
{
oNotice.innerText="Coords: (" + event.clientX + ", " + event.clientY + ")";
document.write("<SPAN ID='oNotice' CLASS='notice' STYLE='position:relative;left:" + event.clientX + ";top:"+ event.clientY +";'></SPAN>")
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript FOR=document EVENT=onmousemove>
<!--
document_onmousemove()
//-->
</SCRIPT>
c if u can fix it ,i m trying that also.
Ianpbaker
Jul 12th, 2000, 04:02 AM
Hi Again Lirlir
Paste this into a new document and see if this is what you want
<html>
<head>
<title>Untitled Document</title>
</head>
<script language="javascript">
if(document.layers) // If Netscape 4
{
layerRef='document.'
topRef='.top'
leftRef='.left'
}
else if(document.all) // If IE4
{
layerRef=''
topRef='.style.pixelTop'
leftRef='.style.pixelLeft'
}
function moveLayer(layer)
{
eval(layerRef+layer+leftRef+'= event.clientX + 10')
eval(layerRef+layer+topRef+'= event.clientY + 10')
}
</script>
<body onmousemove="moveLayer('divMove')">
<div id="divMove" style="position:absolute; left:200; top:200" >This is Fun</div>
</body>
</html>
Ian
lirlir
Jul 12th, 2000, 04:15 AM
yes my main man lan,U R the GURU Master.
see u around
lirlir
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.