metanohi-misc-subsites/old-projects/x/dotspot.htm

89 lines
1.6 KiB
HTML
Raw Normal View History

2011-08-02 19:57:57 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml">
<head>
<title>dotspot</title>
<style type='text/css'>
* {
margin:0;
padding:0;
text-decoration:none;
font-weight:normal;
color:#000;
font:16px arial;
}
body {
font:16px arial;
background-color:#000;
overflow:hidden;
}
div {
position:absolute;
width:20px;
height:20px;
background-color:#fff;
}
#evr {
width:100%;
height:100%;
background-color:#000;
}
</style>
<script type='text/javascript'>
if (self.innerHeight) {
w=self.innerWidth
h=self.innerHeight
}
else if (document.documentElement && document.documentElement.clientHeight) {
w=document.documentElement.clientWidth
h=document.documentElement.clientHeight
}
else if (document.body) {
w=document.body.clientWidth
h=document.body.clientHeight
}
ax=new Array()
ax=[]
ay=new Array()
ay=[]
function drawdot() {
for (c=0; c<10; c++) {
do {
yn=0
x=Math.floor(Math.random()*w)
y=Math.floor(Math.random()*h)
for (i=0; i<ax.length; i++) {
//if (ax[i]>x && ax[i]-9<x && ay[i]>y && ay[i]-9<y || ax[i]<x && ax[i]+9>x && ay[i]<y && ay[i]+9>y)
if (ax[i]==x && ay[i]==y)
yn=1
}
//if (yn==1)
} while (yn==1)
ax[ax.length]=x
ay[ay.length]=y
ne=document.createElement("div")
ne.setAttribute("style","top:"+y+"px;left:"+x+"px")
evr=document.getElementById("evr")
evr.appendChild(ne)
}
t=setTimeout("drawdot()",1)
}
function stopdots() {
clearTimeout(t)
}
window.onload=drawdot
document.onclick=stopdots
</script>
</head>
<body>
<div id='evr'></div>
</body>
</html>