将图片爆破成粒子

<***html***><***head***><***script***>
var imgwidth=209
var imgheight=62
var imgurl="http://cidu.net/dx/call.jpg"
var redirurl="http://cidu.net"
var x_finalpos=250
var y_finalpos=230
var x_slices=8
var y_slices=10
var pause=1
var marginright
var width_slice=Math.floor(imgwidth/x_slices)
var height_slice=Math.floor(imgheight/y_slices)

var cliptop=0
var clipbottom=height_slice
var clipleft=0
var clipright=width_slice
var spancounter=0
var x_random=new Array()
var y_random=new Array()
var max_explsteps=15
var i_explsteps=0

function initiate() {
spancounter=0
for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
x_random[spancounter]=Math.ceil(240*Math.random())-120
y_random[spancounter]=Math.ceil(240*Math.random())-120
spancounter++
}
}
  if (document.all) {
    spancounter=0
  for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
var thisspan=eval("document.all.span"+spancounter+".style")
thisspan.posLeft=x_finalpos
thisspan.posTop=y_finalpos
        thisspan.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
clipleft+=width_slice
    clipright+=width_slice
    spancounter++
}
    clipleft=0
    clipright=width_slice
    cliptop+=height_slice
    clipbottom+=height_slice
}
  }
  if (document.layers) {
    spancounter=0
  for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
var thisspan=eval("document.span"+spancounter)
thisspan.left=x_finalpos
thisspan.top=y_finalpos
        thisspan.clip.left=clipleft
        thisspan.clip.right=clipright
        thisspan.clip.top=cliptop
        thisspan.clip.bottom=clipbottom
clipleft+=width_slice
    clipright+=width_slice
    spancounter++
}
    clipleft=0
    clipright=width_slice
    cliptop+=height_slice
    clipbottom+=height_slice
}
  }
}

function checkbrowser() {
  spancounter=0
if (document.all) {
    explode_IE()
  }
  if (document.layers) {
    explode_NN()
  }
}

function explode_IE() {
spancounter=0
if (i_explsteps<=max_explsteps) {
for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
var thisspan=eval("document.all.span"+spancounter+".style")
thisspan.posLeft+=x_random[spancounter]
thisspan.posTop+=y_random[spancounter]
spancounter++
}
}
i_explsteps++
var timer=setTimeout("explode_IE()",pause)
}
else {
spancounter=0
for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
var thisspan=eval("document.all.span"+spancounter+".style")
thisspan.posLeft=-5000
spancounter++
}
}
clearTimeout(timer)
document.location.href=redirurl
}
}

function explode_NN() {
spancounter=0
if (i_explsteps<=max_explsteps) {
for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
var thisspan=eval("document.span"+spancounter)
thisspan.left+=x_random[spancounter]
thisspan.top+=y_random[spancounter]
spancounter++
}
}
i_explsteps++
var timer=setTimeout("explode_NN()",pause)
}
else {
spancounter=0
for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
var thisspan=eval("document.span"+spancounter)
thisspan.visibility="hidden"
spancounter++
}
}
clearTimeout(timer)
document.location.href=redirurl
}
}

// - End of JavaScript - -->
</script>

<***style***>
.spanstyle {
position:absolute;
  left:-5000px;
}
<****/style****>
<***title***><***/title***>
<***/head***>

<***body bgcolor="#FFFFFF" onLoad="initiate()"***>

<***p***> <***/p***>

<***p***><***script***>
Beginning of JavaScript -
for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
marginright=screen.width+50
  document.write("<***span id='span"+spancounter+"' class='spanstyle'***>")
document.write("<***a href='javascript:' οnmοuseοver='checkbrowser()'***>")
document.write("<***img src='"+imgurl+"' border='0'***>")
document.write("<***/a***>")
  document.write("<***/span***>")
spancounter++
}
}
<***/script***> <****/p>
把上面的代码复制到你的页面上就够了!
<***br***>
下面这段代码仅作调试之用,无需复制
<***/body***>
<***/html***>
<***span id='span0' class='spanstyle'***><**a href='javascript:' οnmοuseοver='checkbrowser()'**><***img src='http://cidu.net/dx/call.jpg' border='0'***><***/a><***/span***><***span id='span1' class='spanstyle'***><***a href='javascript:' οnmοuseοver='checkbrowser()'***><***img src='http://cidu.net/dx/call.jpg' border='0'***><***/a***><***/span***><***span id='span2' class='spanstyle'***><***a href='javascript:' οnmοuseοver='checkbrowser()'***><***img src='http://cidu.net/dx/call.jpg' border='0'***><***/a><***/span***>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值