Created
May 11, 2013 13:44
-
-
Save hbehkamal/5560015 to your computer and use it in GitHub Desktop.
sry dir shod...
systemam kharab bood.
Internetam ham tamum shode bud...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>Programming Practice</title> | |
<style type="text/css"> | |
body{ | |
background-color: lightblue; | |
} | |
.btns{ | |
width:200px; | |
height:60px; | |
background-color: gray; | |
color: black; | |
position: absolute; | |
left:85%; | |
top:85%; | |
font-size:20px; | |
text-align: center; | |
line-height:60px; | |
cursor: pointer; | |
border-radius: 8px; | |
-moz-transition: all 100ms; | |
} | |
</style> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
for(var i=0;i<10;i++){ | |
document.write('<div class="btns">Can You Click Me</div>'); | |
} | |
</script> | |
<script type="text/javascript"> | |
var btns = document.getElementsByClassName('btns'); | |
var rnd = function (max){ | |
return Math.round(Math.random()*max); | |
}; | |
var Move = function (){ | |
this.style.left=rnd(80)+'%'; | |
this.style.top=rnd(80)+'%'; | |
}; | |
var ColorMaker = function(){ | |
var | |
r=rnd(255), | |
g=rnd(255), | |
b=rnd(255); | |
return "rgb("+r+","+g+","+b+")"; | |
}; | |
for(var i=0;i<btns.length;i++){ | |
btns.item(i).onmouseover = Move; | |
btns.item(i).style.backgroundColor = ColorMaker(); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment