It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Creeping Layer

Creeping Layer

Postby DaddyJo on Mon Feb 18, 2008 7:20 am

Im am trying to use Javascript to make a <div> creep along the page but for some reason the argument inside of the creepinglayer function is not valid. Below is the whole html code w/ script included:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Creeping Layer</title>
<style>

#myBox { position:absolute; left:100px; top:50px; width:100px; height:100px;
background-color:#0000FF; }

</style>

<script language="javascript" type="text/javascript">

function creepinglayer() {

document.getElementById("myBox").style.left = eval(parseInt(document.getElementById("myBox").style.left) + 1) + "px"

}

</script>


</head>

<body>

<div id="myBox">

I'm gonna be moving!

</div>

<script language="javascript">

var myTimer = window.setInterval("creepinglayer();", 10)

</script>
</body>
</html>


Thanks for any help that is posted!
DaddyJo
 
Posts: 0
Joined: Mon Feb 18, 2008 7:10 am

Who is online

Users browsing this forum: No registered users and 7 guests