打雷效果

- 中国WEB开发者网络 (http://www.webasp.net)
-- 网页特效 (http://www.webasp.net/javascript/)
--- 打雷效果 (http://www.webasp.net/javascript/1/682.htm)
-- 发布日期: 2005-06-29
<!-- 网页特效代码由[中国WEB开发者网络:http://www.ChinaWebDev.com]提供! -->
<!-- 要实现此效果需要 1 个步骤: -->

<!-- 第 1 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

<STYLE>.mainbody {
COLOR: #ffffff; FONT-FAMILY: Arial; FONT-SIZE: 12pt; LEFT: 260px; POSITION: absolute; TOP: 100px; WIDTH: 300px
}
.soundpic {
LEFT: -400px; POSITION: absolute; TOP: -400px
}
A {
COLOR: #ff0000; TEXT-DECORATION: underline overline
}
</STYLE>
<SCRIPT language=javaScript>
<!-- Beginning of JavaScript -
var x,y,i
var shakestrength=30
var i=shakestrength
var vorzeichen=1

function showsoundpic() {
if (document.all) {
document.all.soundgif1.style.posTop=y-100
document.all.soundgif1.style.posLeft=x
shakesound()
}

if (document.layers) {
document.soundgif1.top=y-100
document.soundgif1.left=x
shakesound()
}
}

function shakesound() {
if (document.all) {
if (i > 0) {
document.all.soundgif1.style.posTop+=i*vorzeichen
document.all.soundgif1.style.posLeft+=i*vorzeichen
vorzeichen=vorzeichen*(-1)
i--
var timer=setTimeout("shakesound()",50)
}
else {
document.all.soundgif1.style.posTop=-400
document.all.soundgif1.style.posLeft=-400
i=shakestrength
clearTimeout(timer)
}
}

if (document.layers) {
if (i > 0) {
document.soundgif1.top+=i*vorzeichen
document.soundgif1.left+=i*vorzeichen
vorzeichen=vorzeichen*(-1)
i--
var timer=setTimeout("shakesound()",50)
}
else {
document.soundgif1.top=-400
document.soundgif1.left=-400
i=shakestrength
clearTimeout(timer)
}
}
}

function makesound(soundobj){
showsoundpic()
var thissound= eval("document."+soundobj)
thissound.play()
}

function handlerMM(e){
x = (document.layers) ? e.pageX : event.clientX
y = (document.layers) ? e.pageY : event.clientY
}
if (document.layers){
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;

// - End of JavaScript - -->

</SCRIPT>
<DIV class=soundpic id=soundgif1><IMG height=300 src="../images/682/flash1611.gif"
width=400> </DIV>
<DIV class=mainbody id=mainbody><A href="http://www.chinawebdev.com"
onmouseover="makesound('sound1')" target=_blank>感受一下雷电效果吧</A>
</DIV><EMBED height=128 hidden=true name=sound1 src=thunder1611.au width=128
MASTERSOUND autostart="false">


webasp.net