|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度' u. D1 f& j* b+ h9 S
var marqueewidth=300/ E/ E; u1 m1 i) q' k8 T! z. C
//高度
; q) B7 o& U+ Rvar marqueeheight=25 y6 Y2 m5 K, v4 L3 G
//速度(1-10)
' z1 s' {: l8 ?' S& w3 jvar marqueespeed=38 l% m/ q) w6 L- k
//背景颜色
0 Y) h- ]2 }6 a# Lvar marqueebgcolor="#FFFFFF"
& Y% n' r5 W; ^; d3 L6 V//是否能暂停 (0=no. 1=yes)?
. D$ u+ ~- {# Q2 ^( n4 Fvar pauseit=1) |1 z) |( ?* @* W/ n2 _4 ~
6 v& }! B; Z) Q//修改显示内容0 c) s S% q! I6 u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 q; B0 u5 c+ u1 Q6 o
* \+ G4 C% d+ E( |
: ~1 O U% H, x////下面不需改变////////////
& [- Y+ m T, L3 `7 {8 B6 L7 R8 M2 ]3 f# r* S+ M
var copyspeed=marqueespeed
! N% y7 o! y% ivar pausespeed=(pauseit==0)? copyspeed: 0
% G7 k; D% E) ~" d) i. |( B" ~var iedom=document.all||document.getElementById
. o3 f' R! a1 d/ ]# t9 @if (iedom)
; I7 G$ k, S1 D2 v$ p- rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 V1 l) ]- ^9 \, Z! `var actualwidth=''
: C6 b# |: S9 C% A& \$ y% Avar cross_marquee, ns_marquee
8 X( Z& J) M; X m
& j8 k H5 H+ _function populate(){
" ^! a, O% o. Q) ~) m2 ?if (iedom){
) w4 e W: ?; pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 n, N1 z- w+ B- L
cross_marquee.style.left=marqueewidth+8
8 V* F) q: ` `- F( @$ }$ s' _( D4 H& pcross_marquee.innerHTML=marqueecontent
0 G6 t0 j8 b& }% f: C/ \8 Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: S- l. V7 { [}
& J! z+ T; @; d- ]else if (document.layers){
( v% O& R+ o. o/ H, E! mns_marquee=document.ns_marquee.document.ns_marquee2; q! ^: }6 ^" v- R
ns_marquee.left=marqueewidth+89 v! y, R& _3 ]# X" n
ns_marquee.document.write(marqueecontent), f$ ^! D# C1 |. X+ w
ns_marquee.document.close()
& S- d% e! S, h; r# z1 I6 U# [3 s- vactualwidth=ns_marquee.document.width
) P" X S1 L% k}. ` B" g+ k" H X$ l. W
lefttime=setInterval("scrollmarquee()",20)& r8 J7 K* m, t5 D7 k
}. o$ w. j* v3 E: d7 ^9 d# N5 O
window.onload=populate
$ @. \! ?0 M ]8 ^; o
! t6 h0 ~3 _7 C$ J$ {function scrollmarquee(){7 F5 f' D7 e5 V+ q. l$ g
if (iedom){
$ U% ?3 i% `* w* dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: k8 n% v0 X% z) j( g/ }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: F, i9 R2 V) p: N" V* }
else
# F0 E5 w9 k& t; { L' B% ecross_marquee.style.left=marqueewidth+8
$ P; _6 _/ g) t5 U6 ~; x3 h% o
9 Q2 g, q, u }3 K; a( b}2 X6 o" M6 }, v% A: c' l* c
else if (document.layers){
- j* I3 {5 k/ M5 T: L. ~. E: N1 aif (ns_marquee.left>(actualwidth*(-1)+8))' P/ X# k4 Q8 ]1 h
ns_marquee.left-=copyspeed9 S. @* V: j5 f- R
else
/ \& n- N* z6 l: S) p7 kns_marquee.left=marqueewidth+8
& @5 t* m# U* g1 K% w0 e" Q}4 r Q4 H4 R, G7 D" O& M+ d
}
8 g7 w: F" T4 u0 r) v) H# G( r! B( i) e% a
if (iedom||document.layers){
; b# g1 z: A( {) X; fwith (document){
) S' _$ z' R3 [+ b7 S% [; udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
T! X* |% L) Cif (iedom){
& ?. j( \' D& L9 q5 P8 O6 wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 A# K# g7 F0 n- W Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( `8 v+ ?4 E F9 O5 l0 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 u& {1 E0 }' x8 R2 E0 _7 d( ]
write('</div>')
! C- U# t4 a$ w: o% m) v}
( k* j( B* E: {" velse if (document.layers){% D7 `3 _! Y) A- }6 d0 X" }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 |# r# Y) y7 d) O" `& |9 a6 Q: a# @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% v& L9 ?2 y9 y" d' e) p& ]8 |write('</ilayer>')6 p4 e8 s' i9 N' D w
}( v* C7 K; q5 k. o3 N
document.write('</td></table>')* r/ r- p% t P' u
}! i1 M: d0 l1 Y2 E
}
( T/ x+ s1 g5 J3 z4 Q</script> |
|