this works for me in ffox 3.0.6:
flake.js:
Code:
/* -*- c++ -*- */
function dotFlake(xLoc,yLoc){
this.init(xLoc,yLoc);
this.x = xLoc;
this.y = yLoc;
this.move(0,0);
};
dotFlake.prototype = {
init:function(x,y){
this.obj = document.getElementById('basicFlake');
},
move:function(dx,dy){
this.x += dx;
this.y += dy;
this.obj.style.cssText = 'position: absolute; top: ' + this.x + 'px; left: ' + this.y + 'px;';
}
};
var flake;
function snow(){
var dx = Math.random()*100 -50, dy = Math.random()*100 -50;
flake.move(dx,dy);
};
window.onload = function(ev){
flake = new dotFlake(100,100);
setInterval(snow,1000);
};
index.html:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="flakes.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="description" content="" />
<meta name="keywords" content="" />
</head>
<body>
<h1>This is test text.</h1>
<img id="basicFlake" src="./simpleDotFlake.png" style="width:10;height:10;" />
</body>
</html>
best regards