Copy Code code as follows:
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> use JavaScript to prevent the feather effect code in PS-www.jb51.net</title>
<body onload=setvalues () >
<center>
<script language=javascript>
<!--beginning of JavaScript-
var x,y
var marginbottom
var marginleft=0
var margintop=0
var marginright
var cliptop
var clipbottom
var clipleft
var clipright
var clippoints
var ballheight=150
var ballwidth=150
var imageheight=525
var imagewidth=457
var tempo=25
var stepx=12
var stepy=6
var timer
function Setvalues () {
if (document.all) {
MarginBottom = Imageheight-ballheight
MarginRight = Imagewidth-ballwidth
Document.all.ball.style.posleft=randommaker (400)
Document.all.ball.style.postop=0
Document.all.textcontent.style.posleft=0
Document.all.textcontent.style.postop=0
Document.all.ball.style.filter= "Alpha" (opacity=0,finishopacity=100,style=2,startx=0px,starty=0px,finishx=100px, finishy=100px) "
Moveball ()
}
}
Randomfunction
function Randommaker (range) {
Rand=math.floor (Range*math.random ())
return Rand
}
function Moveball () {
Checkposition ()
if (document.all) {
Document.all.ball.style.posleft+=stepx
Document.all.ball.style.postop+=stepy
Cliptop=document.all.ball.style.postop
Clipbottom=cliptop+ballheight
Clipleft=document.all.ball.style.posleft
Clipright=clipleft+ballwidth
clippoints= "Rect" ("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+") "
Document.all.textcontent.style.clip=clippoints
Timer=settimeout ("Moveball ()", tempo)
}
}
function Checkposition () {
if (document.all) {
if (document.all.ball.style.posleft>=marginright) {
Stepx=stepx*-1
document.all.ball.style.posleft-=10
}
if (document.all.ball.style.posleft<=marginleft) {
Stepx=stepx*-1
document.all.ball.style.posleft+=10
}
if (Document.all.ball.style.postop>=marginbottom) {
Stepy=stepy*-1
document.all.ball.style.postop-=10
}
if (document.all.ball.style.postop<=margintop) {
Stepy=stepy*-1
document.all.ball.style.postop+=10
}
}
}
-End of JavaScript--->
</SCRIPT>
<span id=textcontent style= "left: -5000px; Position:absolute; Top: -2000px "> </span>
<span id=ball style= "background-color:white; height:150px; Position:absolute; Top: -50px; width:150px "></span>
</center>
</body>