Gå til innhold

Et lite irriterende script...


Anbefalte innlegg

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>

<head>
<title>
Trykk på lenken
</title>
<script type="text/javascript">
// skrevet av LostOblivion =]
var boxXPos, boxYPos, boxWidth, boxHeight, boxHandle;
window.onload = function()
{
boxXPos = 300;
boxYPos = 200;
boxWidth = 100;
boxHeight = 40;
boxHandle = document.getElementById("box");
}
function jump()
{
boxHandle.style.left = (boxXPos = Math.random(1) * 600) + "px";
boxHandle.style.top = (boxYPos = Math.random(1) * 450) + "px";
}
document.onmousemove = function(e)
{
mouseXPos = e.x || e.pageX;
mouseYPos = e.y || e.pageY;
if (mouseXPos < boxXPos && mouseXPos > boxXPos - 30 && mouseYPos > boxYPos - 30 && mouseYPos < boxYPos + boxHeight + 30)
 boxHandle.style.left = (boxXPos = mouseXPos + 30) + "px";
if (mouseXPos > boxXPos + boxWidth && mouseXPos < boxXPos + boxWidth + 30 && mouseYPos > boxYPos - 30 && mouseYPos < boxYPos + boxHeight + 30)
 boxHandle.style.left = (boxXPos = mouseXPos - boxWidth - 30) + "px";
if (mouseYPos < boxYPos && mouseYPos > boxYPos - 30 && mouseXPos > boxXPos - 30 && mouseXPos < boxXPos + boxWidth + 30)
 boxHandle.style.top = (boxYPos = mouseYPos + 30) + "px";
if (mouseYPos > boxYPos + boxHeight && mouseYPos < boxYPos + boxHeight + 30 && mouseXPos > boxXPos - 30 && mouseXPos < boxXPos + boxWidth + 30)
 boxHandle.style.top = (boxYPos = mouseYPos - boxHeight - 30) + "px";
if (boxXPos + boxWidth < 0 || boxXPos > 600 || boxYPos + boxHeight < 0 || boxYPos > 450)
 jump();
}
function myBlur(obj)
{
alert("Trodde du var smart nå? =]");
obj.blur();
}
</script>
<style type="text/css">
* {
font-family: Verdana, sans-serif;
font-size: 11px;
color: #036;
}
body {
margin: 0;
padding: 0;
}
div#box {
position: absolute;
padding: 5px;
width: 90px;
height: 30px;
left: 300px;
top: 200px;
border: 1px solid #036;
text-align: center;
}
</style>
</head>

<body>
<div id="box" onmouseover="jump();">
<a href="http://www.google.com" onfocus="myBlur(this);">Bare prøv...</a>
</div>
</body>

</html>

 

Edit: Nå skulle det funke i Firefox og Netscape også.

Endret av LostOblivion
Lenke til kommentar
  • 1 måned senere...
Videoannonse
Annonse

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...