<SCRIPT>
<!-- Beginning of JavaScript -
var debrisnumber=15 //하트 수
var debriscolor=new Array()
var x_debrispos
var y_debrispos
var x,y
var x_random=new Array()
var y_random=new Array()
var max_explsteps=20 //이동 거리
var i_explsteps=0
var i_color=0
var pause=10
function checkbrowser() {
i_explsteps=0
x_debrispos=x
y_debrispos=y
for (i=0;i<=debrisnumber;i++) {
x_random[i]=Math.ceil(40*Math.random())-20
y_random[i]=Math.ceil(40*Math.random())-20
}
if (document.all) {
for (i=0;i<=debrisnumber;i++) {
var thisspan=eval("document.all.span"+i+".style")
thisspan.visibility="VISIBLE"
thisspan.posLeft=x_debrispos
thisspan.posTop=y_debrispos
}
explode_IE()
}
if (document.layers) {
for (i=0;i<=debrisnumber;i++) {
var thisspan=eval("document.span"+i)
thisspan.visibility="VISIBLE"
thisspan.left=x_debrispos
thisspan.top=y_debrispos
}
explode_NN()
}
}
function explode_IE() {
if (i_explsteps<=max_explsteps) {
for (i=0;i<=debrisnumber;i++) {
var thisspan=eval("document.all.span"+i+".style")
thisspan.posLeft+=x_random[i]
thisspan.posTop+=y_random[i]
}
i_explsteps++
var timer=setTimeout("explode_IE()",pause)
}
else
{
for (i=0;i<=debrisnumber;i++) {
var thisspan=eval("document.all.span"+i+".style")
thisspan.visibility="HIDDEN"
}
clearTimeout(timer)
}
}
function explode_NN() {
if (i_explsteps<=max_explsteps) {
for (i=0;i<=debrisnumber;i++) {
var thisspan=eval("document.span"+i)
thisspan.left+=x_random[i]
thisspan.top+=y_random[i]
}
i_explsteps++
var timer=setTimeout("explode_NN()",pause)
}
else
{
for (i=0;i<=debrisnumber;i++) {
var thisspan=eval("document.span"+i)
thisspan.visibility="HIDDEN"
}
clearTimeout(timer)
}
}
function handlerMM(e){
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
}
if (document.layers){
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// - End of JavaScript - -->
</SCRIPT>
<STYLE>
.spanstyle
{
POSITION: absolute; VISIBILITY: hidden
}
</STYLE>
<SCRIPT>
<!-- Beginning of JavaScript -
for (i=0;i<=debrisnumber;i++) {
document.write("<div id='span"+i+"' class='spanstyle'>")
document.write("<table cellpadding=0 cellspacing=0>")
document.write("<font color=FF99FF SIZE=2>♡</font>")
document.write("</table>")
document.write("</div>")
i_color++
if (i_color>=debriscolor.length) {i_color=0}
}
// - End of JavaScript - -->
</SCRIPT>
<br><center>
<A href="문서경로" onmouseover=checkbrowser()>요기에 마우스를 대어보세요</A>
'Javascript' 카테고리의 다른 글
링크할곳에 마우스를 위치 시키면 배경색이 (0) | 2016.06.02 |
---|---|
튀어 나오는 글자 (0) | 2016.06.02 |
날아라~! (0) | 2016.06.02 |
클릭하면 배경그림이 바뀐다 (0) | 2016.06.02 |
팝업창을 원래의 크기로 자동으로 (0) | 2016.06.02 |