2008年8月29日

有点像蜘蛛侠

代码效果:有点像蜘蛛侠

代码如下:

<!--将以下代码加入HTML的<body></body>之间--> <br /> <br /><style> <br />.disableHscroll{ <br />width:100%;overflow-x:hidden;overflow-y:scroll; <br />} <br />v\:* { <br /> BEHAVIOR: url(#default#VML) <br />} <br /></style><script> <br />var defaultcolor="#000000" <br />var lineweighthighlight=1 <br />var lineweightnormal=1 <br />var distancetomouse=0 <br />var mousepos_x=0 <br />var mousepos_x=0 <br />var marginleft=0 <br />var margintop=0 <br />var marginbottom=0 <br />var marginright=0 <br />var margincenterx <br />var margincentery <br />var mousepos_x=0 <br />var mousepos_x=0 <br />if (document.all&amp;&amp;window.print){ <br /> document.write('<div id="bodycontent" style="position:relative"') <br />} <br />function initiateanimation(){ <br /> marginbottom=document.body.clientHeight <br /> marginright=document.body.clientWidth <br /> margincenterx=Math.floor(marginright/2) <br /> margincentery=Math.floor(marginbottom/2) <br /> rectangulartopleft.to=marginleft+","+margintop <br /> rectangulartopright.to=marginright+","+margintop <br /> rectangularbottomleft.to=marginleft+","+marginbottom <br /> rectangularbottomright.to=marginright+","+marginbottom <br /> rectangulartop.to=margincenterx+","+margintop <br /> rectangularright.to=marginright+","+margincentery <br /> rectangularbottom.to=margincenterx+","+marginbottom <br /> rectangularleft.to=marginleft+","+margincentery <br /> rectangulartopleft.strokecolor=defaultcolor <br /> rectangulartopright.strokecolor=defaultcolor <br /> rectangularbottomleft.strokecolor=defaultcolor <br /> rectangularbottomright.strokecolor=defaultcolor <br /> rectangulartop.strokecolor=defaultcolor <br /> rectangularright.strokecolor=defaultcolor <br /> rectangularbottom.strokecolor=defaultcolor <br /> rectangularleft.strokecolor=defaultcolor} <br />function msover(thiscolorhighlight){ <br /> if(document.all&amp;&amp;window.print){ <br /> rectangulartopleft.strokecolor=thiscolorhighlight <br /> rectangulartopright.strokecolor=thiscolorhighlight <br /> rectangularbottomleft.strokecolor=thiscolorhighlight <br /> rectangularbottomright.strokecolor=thiscolorhighlight <br /> rectangulartop.strokecolor=thiscolorhighlight <br /> rectangularright.strokecolor=thiscolorhighlight <br /> rectangularbottom.strokecolor=thiscolorhighlight <br /> rectangularleft.strokecolor=thiscolorhighlight <br /> rectangulartopleft.strokeweight=lineweighthighlight <br /> rectangulartopright.strokeweight=lineweighthighlight <br /> rectangularbottomleft.strokeweight=lineweighthighlight <br /> rectangularbottomright.strokeweight=lineweighthighlight <br /> rectangulartop.strokeweight=lineweighthighlight <br /> rectangularright.strokeweight=lineweighthighlight <br /> rectangularbottom.strokeweight=lineweighthighlight <br /> rectangularleft.strokeweight=lineweighthighlight <br /> } <br />} <br />function msout(){ <br /> if(document.all&amp;&amp;window.print){ <br /> rectangulartopleft.strokecolor=defaultcolor <br /> rectangulartopright.strokecolor=defaultcolor <br /> rectangularbottomleft.strokecolor=defaultcolor <br /> rectangularbottomright.strokecolor=defaultcolor <br /> rectangulartop.strokecolor=defaultcolor <br /> rectangularright.strokecolor=defaultcolor <br /> rectangularbottom.strokecolor=defaultcolor <br /> rectangularleft.strokecolor=defaultcolor <br /> rectangulartopleft.strokeweight=lineweightnormal <br /> rectangulartopright.strokeweight=lineweightnormal <br /> rectangularbottomleft.strokeweight=lineweightnormal <br /> rectangularbottomright.strokeweight=lineweightnormal <br /> rectangulartop.strokeweight=lineweightnormal <br /> rectangularright.strokeweight=lineweightnormal <br /> rectangularbottom.strokeweight=lineweightnormal <br /> rectangularleft.strokeweight=lineweightnormal <br /> } <br />} <br />function momouse(){ <br /> if(document.all&amp;&amp;window.print){ <br /> mousepos_x=document.body.scrollLeft+event.clientX <br /> mousepos_y=document.body.scrollTop+event.clientY <br /> rectangulartopleft.from=mousepos_x+","+mousepos_y <br /> rectangulartopright.from=mousepos_x+","+mousepos_y <br /> rectangularbottomleft.from=mousepos_x+","+mousepos_y <br /> rectangularbottomright.from=mousepos_x+","+mousepos_y <br /> rectangulartop.from=mousepos_x+","+mousepos_y <br /> rectangularright.from=mousepos_x+","+mousepos_y <br /> rectangularbottom.from=mousepos_x+","+mousepos_y <br /> rectangularleft.from=mousepos_x+","+mousepos_y <br /> } <br />} <br />if(document.all&amp;&amp;window.print){ <br /> document.body.className="disableHscroll" <br /> code="<v:line id="rectangulartopleft" style="'LEFT:0;POSITION:absolute;TOP:0;'" strokeweight="'"></v:line>" <br /> code+="<v:line id="rectangulartopright" style="'LEFT:0;POSITION:absolute;TOP:0;'" strokeweight="'"></v:line>" <br /> code+="<v:line id="rectangularbottomleft" style="'LEFT:0;POSITION:absolute;TOP:0;'" strokeweight="'"></v:line>" <br /> code+="<v:line id="rectangularbottomright" style="'LEFT:0;POSITION:absolute;TOP:0;'" strokeweight="'"></v:line>" <br /> code+="<v:line id="rectangulartop" style="'LEFT:0;POSITION:absolute;TOP:0;'" strokeweight="'"></v:line>" <br /> code+="<v:line id="rectangularright" style="'LEFT:0;POSITION:absolute;TOP:0;'" strokeweight="'"></v:line>" <br /> code+="<v:line id="rectangularbottom" style="'LEFT:0;POSITION:absolute;TOP:0;'" strokeweight="'"></v:line>" <br /> code+="<v:line id="rectangularleft" style="'LEFT:0;POSITION:absolute;TOP:0;'" strokeweight="'"></v:line>" <br /> document.body.insertAdjacentHTML("afterBegin",code) <br /> document.onmousemove=momouse <br /> window.onload=initiateanimation <br />} <br /></script>

没有评论: