Results 1 to 7 of 7

Thread: how 2 put pixel ...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    156

    Unhappy

    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)"
    The MORE I get to know,
    I realize that I know NOTHING !

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696

    Smile

    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
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    156

    Smile

    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
    The MORE I get to know,
    I realize that I know NOTHING !

  4. #4
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi lirlir

    What you are asking isn't to hard I will try to knock it up on my lunch break.

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    156

    Arrow

    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.
    The MORE I get to know,
    I realize that I know NOTHING !

  6. #6
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi Again Lirlir

    Paste this into a new document and see if this is what you want
    Code:
    <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
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    156

    Cool

    yes my main man lan,U R the GURU Master.


    see u around
    lirlir
    The MORE I get to know,
    I realize that I know NOTHING !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width