返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 n5 F1 f- j  ?$ ~' _var marqueewidth=300
4 g) ^5 j% P6 E8 \% q9 a$ H//高度
) d( B+ M1 b5 P" L4 s; \var marqueeheight=25
, V8 P+ O9 D$ k+ `+ a( k//速度(1-10)
1 I( C8 L0 s5 [7 \var marqueespeed=3
  h0 o- C1 r0 n+ U/ {! `' y! d//背景颜色
+ M' j. r  q5 q! l3 fvar marqueebgcolor="#FFFFFF"; e" w( ?7 W3 R9 c) J; V; ]: F4 C
//是否能暂停 (0=no. 1=yes)?- h, T, K: s; U
var pauseit=1+ R# N  D# Z2 ]4 u& x
# ]4 g# E* n+ M: |/ @5 `+ ~1 c9 a
//修改显示内容' T" Y5 g+ h  _- P6 w3 i* W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ Z8 T1 @+ I2 R4 f+ G! \5 |

! s9 `) a* \" }2 l) L" \% m6 |  F! K8 ^
////下面不需改变////////////2 f. X4 l# i/ _) r; y
( j/ x  L! h6 I1 R
var copyspeed=marqueespeed' F) s/ {: B: h+ o5 R! A1 {( ~
var pausespeed=(pauseit==0)? copyspeed: 06 {, N  T4 H+ ^4 ?
var iedom=document.all||document.getElementById
' U) ~- d& W5 ^if (iedom)
- Z) o1 o" y( W8 D, _4 ~5 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' Z: K, t3 s, B' s: Jvar actualwidth=''7 G1 e& T) y0 y& a( S/ y0 J
var cross_marquee, ns_marquee
) i1 ^: D: \' y; E- Q  ]0 y4 v/ Q
" [- T$ l8 }1 S8 G) y2 Y# x+ R- Bfunction populate(){
: I$ r4 I7 {/ {8 ~/ _- X* ?) pif (iedom){3 U4 |# D! M; t7 F% `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" n" @, |7 s. t( L1 O, p
cross_marquee.style.left=marqueewidth+8: j/ Q9 j( f/ M3 \5 b; v# v
cross_marquee.innerHTML=marqueecontent8 S# `" W5 `9 ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 M9 ~2 Q+ O) P3 h/ w  `0 W+ t}+ O4 N- f" L0 P
else if (document.layers){5 M* E( z1 k: l' {0 Q0 w4 `* ~) h
ns_marquee=document.ns_marquee.document.ns_marquee2
' U9 X3 L! s9 [% g0 l' ^$ hns_marquee.left=marqueewidth+8
, V8 {* n5 s1 e3 m/ b" `ns_marquee.document.write(marqueecontent)2 i# G' W+ D3 {$ F- B
ns_marquee.document.close()
% _$ r* w3 ?# c  q5 n8 tactualwidth=ns_marquee.document.width
2 ^6 q, U; ^2 Y  \, J7 j7 [9 i}
. z; e9 d7 ^: W$ hlefttime=setInterval("scrollmarquee()",20)
$ \+ B0 ~" s; C# Z/ X4 R7 @3 I}
* T2 u( u& a  zwindow.onload=populate
* [3 H. C& P/ W$ ^  E1 d7 t* G
% y8 s0 [$ s$ p  t1 n- l& S+ q+ \function scrollmarquee(){
, V0 j1 T0 d2 W! \if (iedom){8 i& {6 f" D% M7 {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ l% @' i# y7 ~, Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  b9 K* I! c' a# x8 R& Pelse
% M1 f& f; f- `, Y4 U# zcross_marquee.style.left=marqueewidth+8. k6 [; ~/ c4 S7 H
. Q, b1 g5 K: V; w2 _) v6 f
}
& ^) v$ R- A5 X. y; K/ o' kelse if (document.layers){
! D( {% Z; r* m- s1 v# Oif (ns_marquee.left>(actualwidth*(-1)+8))
( w+ @7 b. j; e7 `  N* Jns_marquee.left-=copyspeed
8 f; S4 M( u# P0 w8 e1 B3 ^/ f1 qelse
3 `/ j7 E) y3 N1 hns_marquee.left=marqueewidth+8, `" a6 K+ O; V7 t. b$ I
}+ m  L1 W0 G6 F6 L3 z
}( D+ a$ }9 Z( D6 x% R

& D: M/ ?- W. @' X6 I( dif (iedom||document.layers){
- |7 d7 T) n6 B5 K# dwith (document){/ g6 U, V; J* k% z' K7 y% f" \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ q5 g7 L/ ~( R7 y! ^if (iedom){8 T; P3 G3 K- g( J: t7 P5 f* I7 Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); I4 T, Z8 X+ G' ]. v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 H5 K! t  N; \( z( l4 J  p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 Z% ^' a) _2 H" X
write('</div>')! j1 r4 t4 z6 j9 r6 D
}3 i$ [+ g3 ~. O4 _! n
else if (document.layers){
; _6 v1 ]  |* r( i6 }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 L2 V9 J, K5 ]5 S6 X4 Z) T  qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! c% v9 j( ^" |
write('</ilayer>')
  a0 x0 x5 Q  a6 s+ z' K}
! s/ g: @/ d# ]& n$ \( }2 Pdocument.write('</td></table>')4 T1 d  h9 s  h
}7 @- f0 l$ T5 j/ `( a
}
. `6 ?: c8 }4 O+ H% m: J. S; K</script>

返回列表
【捌玖网络】已经运行: