Connecting Tech Pros Worldwide Forums | Help | Site Map

moving text on the screen with javascript

Death Slaught's Avatar
Site Addict
 
Join Date: Aug 2007
Location: Tennessee
Posts: 952
#1: Oct 11 '07
Here comes the headaches.


Ok I need to know how to do the following. (I think my brains gona fall out.....please don't just give me the answer but talk me through it so I can understand it.)



I need to know how to make text scroll across a limited amount of space across the screen.

I need to know how to put pauses(or reduce the speed) of/in the text.

Also I need to insert this into certain words.

[HTML]<html>
<head>
<script>
function startEQ()
{
richter=5
parent.moveBy(0,richter)
parent.moveBy(0,-richter)
parent.moveBy(richter,0)
parent.moveBy(-richter,0)
timer=setTimeout("startEQ()",10)
}
function stopEQ()
{
clearTimeout(timer)
}
</script>
</head>
<body>

<form>
<input type="button" onclick="startEQ()" value="Start an earthquake">
<br />
<br />
<input type="button" onclick="stopEQ()" value="Stop the earthquake">
</form>

</body>
</html>[/HTML]

but I want it to happen on certain words, and the user doesn't/can't click any thing.

I also need to know how to decorate the scrolling text, like change its color, make it glow.....etc.

And it needs to go from right to left.

And on certain words I need to know how to change the background's color/image.

--------------------------------------------------------------------------------------------------------------------

What I want this for is a music video, and the text scrolling below it is the lyrics.

Thanks, Death

gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,246
#2: Oct 12 '07

re: moving text on the screen with javascript


hi ...

i splitted this post from the original thread since it concerns a very different topic ...

kind regards
Death Slaught's Avatar
Site Addict
 
Join Date: Aug 2007
Location: Tennessee
Posts: 952
#3: Oct 12 '07

re: moving text on the screen with javascript


Quote:

Originally Posted by gits

hi ...

i splitted this post from the original thread since it concerns a very different topic ...

kind regards

Thanks

- Death
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,750
#4: Oct 15 '07

re: moving text on the screen with javascript


Put the words in a span/div and change the top and left properties.
Death Slaught's Avatar
Site Addict
 
Join Date: Aug 2007
Location: Tennessee
Posts: 952
#5: Oct 15 '07

re: moving text on the screen with javascript


Quote:

Originally Posted by acoder

Put the words in a span/div and change the top and left properties.

A: How do I change the top and left properties I googled it, and I get CSS.

B: how do I add the earthquake effect on certain words???

I don't want the answer, but can you atleast point me in the right direction. ( examples are always great lol).


Thanks, Death
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,750
#6: Oct 15 '07

re: moving text on the screen with javascript


Quote:

Originally Posted by Death Slaught

A: How do I change the top and left properties I googled it, and I get CSS.

You would use the style property, e.g.:
Expand|Select|Wrap|Line Numbers
  1. element.style.left = (parseInt(element.style.left) + 5) + "px";
Reply