Click to See Complete Forum and Search --> : How would i go about coding this?
Scuttle
04-21-2001, 08:59 AM
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. http://www.sharkyforums.com/ubb/smile.gif
------------------
Junior SBC member 05
Sharky Badge (http://members.fortunecity.com/awa64/sbc/sbcscu.jpg)
Blow up some threads at Combustion Junction (http://hogg.dynu.com/cgi-bin/yabb.pl.)
My first site! (http://www.darksavior.net/~scuttle)
MY FORUMS!!! (http://www.darksavior.net/~scuttle/cgi-bin/yabb/YaBB.pl)
namgor
04-21-2001, 12:45 PM
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 http://www.sharkyforums.com/ubb/smile.gif
------------------
I am crab, scoins is crap.
Scuttle
04-21-2001, 05:51 PM
Thanks for the swift reply. http://www.sharkyforums.com/ubb/smile.gif
------------------
Junior SBC member 05
Sharky Badge (http://members.fortunecity.com/awa64/sbc/sbcscu.jpg)
Blow up some threads at Combustion Junction (http://hogg.dynu.com/cgi-bin/yabb.pl.)
My first site! (http://www.darksavior.net/~scuttle)
MY FORUMS!!! (http://www.darksavior.net/~scuttle/cgi-bin/yabb/YaBB.pl)