How would i go about coding this?

Sharky Forums


Results 1 to 3 of 3

Thread: How would i go about coding this?

  1. #1
    Cookiecutter Shark Scuttle's Avatar
    Join Date
    Oct 2000
    Location
    England
    Posts
    7,508

    Question How would i go about coding this?

    What i'd like to do is that when people visit my initial webapge some text follows the cursor around the screen saying something that i'll decide on at some point. And then, when the cursor stops moving, the text all lines up. I think that this would be used using Javascripting, but i know very little about it, so some help would be much appreciated. I've another question, but i'll overcome one problem at a time.


    Thanks.

    ------------------
    Junior SBC member 05
    Sharky Badge

    Blow up some threads at Combustion Junction

    My first site!

    MY FORUMS!!!

  2. #2
    Hammerhead Shark
    Join Date
    Oct 2000
    Location
    Toronto, Canada
    Posts
    1,493

    Post

    Initially, put this between your <head> </head>

    <script><!--
    var x,y
    var step=20
    var flag=0

    var message="U W C D C ! "
    message=message.split("")

    var xpos=new Array()
    for (i=0;i<=message.length-1;i++) {
    xpos[i]=-50
    }

    var ypos=new Array()
    for (i=0;i<=message.length-1;i++) {
    ypos[i]=-50
    }


    function handlerMM(e){
    x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
    y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
    flag=1
    }

    function makesnake() {
    if (flag==1 && document.all) {
    for (i=message.length-1; i>=1; i--) {
    xpos[i]=xpos[i-1]+step
    ypos[i]=ypos[i-1]
    }
    xpos[0]=x+step
    ypos[0]=y

    for (i=0; i<message.length-1; i++) {
    var thisspan = eval("span"+(i)+".style")
    thisspan.posLeft=xpos[i]
    thisspan.posTop=ypos[i]
    }
    }

    else if (flag==1 && document.layers) {
    for (i=message.length-1; i>=1; i--) {
    xpos[i]=xpos[i-1]+step
    ypos[i]=ypos[i-1]
    }
    xpos[0]=x+step
    ypos[0]=y

    for (i=0; i<message.length-1; i++) {
    var thisspan = eval("document.span"+i)
    thisspan.left=xpos[i]
    thisspan.top=ypos[i]
    }
    }
    var timer=setTimeout("makesnake()",30)
    }
    // -->
    </script>
    <script language="JavaScript">

    function stopErrors() {

    return true;

    }

    window.onerror = stopErrors


    //-->

    </script>


    then, in your <body> tag, add this

    <body onload="makesnake()">


    I copyed this straight out from http://www.uwcdc.com

    Go take a look at their website or even sign their guest book if you have time

    ------------------
    I am crab, scoins is crap.
    DHAHL3seasons GP:73 G:121 A:55 Pts:176 GWG:12 +/-:184
    UWSWA6seasons GP:41 G:53 A:46 Pts:99 GWG:5 +/-:-25
    MCBHL3seasons GP:14 G:20 A:8 Pts:28 GWG:4 +/-:19

    uwcdc.com or monkis.com

  3. #3
    Cookiecutter Shark Scuttle's Avatar
    Join Date
    Oct 2000
    Location
    England
    Posts
    7,508

    Talking

    Thanks for the swift reply.

    ------------------
    Junior SBC member 05
    Sharky Badge

    Blow up some threads at Combustion Junction

    My first site!

    MY FORUMS!!!

Posting Permissions

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