Jump to content

Half Javascript, half CSS problem


Lucifrex
 Share

Recommended Posts

Ok, here be code:

<html><head><script type="text/javascript"><!--var x = 0function scroll(){document.getElementById('head').style.posTop=xx=x+1t = setTimeout('scroll()',100)}//--></script></head><body><h1 id="head">Hello</h1></body></html>

I think that one of the main problems is that I have no idea what posTop does... lol. Please help. I'm trying to make the text go move downwards.

Link to comment
Share on other sites

As far as I know posTop is not a CSS attribute.Use this...it works.

<html><head><script type="text/javascript"><!--var x=0;function scroll(){document.getElementById('head').style.position='absolute';document.getElementById('head').style.left=x+'px';x=x+1t = setTimeout('scroll()',100)}//--></script></head><body onload="scroll()"><h1 id="head">Hello</h1></body></html>

you could also do some checks to make sure it is within a specific range and then reset when it gets to the maximum range.Or if you are ambitious you could have it change to scroll left once it gets to the right.Have fun

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...