Friday, October 23, 2009

More fun with CSS and Javascript

This one was just weird... whatever

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>

<script type="text/javascript">

function d2h(d){return d.toString(16);}

</script>

</head>

<body>

<script type="text/javascript">

var x=0;

var y=0;

var z=0;

var c=0;

for (z=0; z<=300; z++)

{

if ((Math.floor(Math.random()*2)) == 0)

{

x=Math.floor(Math.random()*100 + Math.floor(Math.random()*1100));

y=Math.floor(Math.random()*100 + Math.floor(Math.random()*2)*600);

}

else

{

x=Math.floor(Math.random()*100 + Math.floor(Math.random()*2)*1100);

y=Math.floor(Math.random()*100 + Math.floor(Math.random()*600));

}

c=d2h(Math.floor(Math.random()*16777215))

document.write("<p style=\"height:1; position:fixed; top:" + y + "px; left:" + x + "px; color:#" + c + "\">Happy Birthday!</p>");

document.write("<p style=\"float:left; height:0px\">" + Math.random() + "</p>");

document.write("<p style=\"float:right; height:0px\">" + Math.random() + "</p><br /><br />");

}

</script>

</body>

</html>

No comments: