返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( Q$ I, ~, w8 A% E( v  c3 X1 Vvar marqueewidth=300
" y- O5 {* n1 S2 r7 g//高度
! s# A" P8 E2 s' D/ Ivar marqueeheight=252 U3 G; U2 [* [9 L, f" B: ?. \
//速度(1-10)0 i1 ]. b; y, o; M
var marqueespeed=3( e) ~5 D& X9 u9 H7 W
//背景颜色
' i# ~2 \* L+ X) |! n& i0 g# Wvar marqueebgcolor="#FFFFFF"
- B  ]& `# {1 I* u; b7 y//是否能暂停 (0=no. 1=yes)?. W$ q3 g4 P  x5 J1 `
var pauseit=1
/ \  J. F" C& e4 s& h+ ?; u3 H, x
- B. g! E$ n, G, t2 G& }//修改显示内容
' ?2 T) d( M# R( X/ _9 p+ Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ Q+ F/ [* W* G$ C; i5 P  V4 W6 Z0 M$ e

0 E( X8 o' t) j& x1 j, T////下面不需改变////////////! E) C5 e( B1 K, S5 \/ T7 v8 A
! }) K! _( D6 O7 c& y% S
var copyspeed=marqueespeed* F5 _- {$ X* v% S9 q& L  q7 q
var pausespeed=(pauseit==0)? copyspeed: 0
) n, R, N, D: Xvar iedom=document.all||document.getElementById5 h5 b$ Z5 `8 c4 h, a; c* ^
if (iedom)" H: V& z6 @$ [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 V# |0 n+ P/ A1 [6 ?1 M0 g
var actualwidth=''1 Q) u- Z8 K  l2 {7 k- }
var cross_marquee, ns_marquee6 `) l: V& A7 D

& u7 E# q; a' W3 A& a, l+ sfunction populate(){
& L  `, C$ }) Q( Z: |: m- aif (iedom){
& T2 n! b; K, m! J) ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 _% L+ \- p" j5 icross_marquee.style.left=marqueewidth+87 C2 ?: C# D" B: u( p* ~, g
cross_marquee.innerHTML=marqueecontent
, j0 r% q& x* _* d! s* m9 factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* B& N/ K9 `# I/ D1 k4 \. p}
' D0 j0 o' i+ G9 @) Q5 `/ {else if (document.layers){
& j* C8 n% Q  Sns_marquee=document.ns_marquee.document.ns_marquee26 V/ W! A( a8 i
ns_marquee.left=marqueewidth+8' x$ ^; p7 G% P- B* k: O
ns_marquee.document.write(marqueecontent)/ U: z& Z/ H8 j
ns_marquee.document.close()
/ r7 W0 I& s* ^, cactualwidth=ns_marquee.document.width! E2 |9 ^5 E6 l; k6 t0 U4 s
}0 B( j' Q9 @6 o7 l2 S% t% d
lefttime=setInterval("scrollmarquee()",20)0 T: z1 \: S8 z3 u- H% Z9 Y
}
1 B! L5 \- v# z6 S, L6 o7 `( ^window.onload=populate
% o) }, J) a& a1 N: T5 j
+ j) p* i  p- A& a, hfunction scrollmarquee(){' I  E% I7 \0 z3 O
if (iedom){& k0 `" W7 f" `* v# K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ Q/ D( Q) S5 t. `2 a3 L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; o& U2 P7 I( ~7 J$ ~1 Q
else
" c" E, G# s9 |8 Q; T2 M; m+ m- \3 Jcross_marquee.style.left=marqueewidth+8
3 \: T( Z1 |' x7 P4 p9 I( p
9 X+ w. Z% a0 e1 f! u}! r9 K; Z; Q+ i0 P0 Z$ v
else if (document.layers){
3 _: W6 B- }7 L; Nif (ns_marquee.left>(actualwidth*(-1)+8))
( P4 k$ j0 N' g8 f  P% U6 Mns_marquee.left-=copyspeed3 {1 d8 u$ P3 g4 Z# \! v
else
. \5 ~! }  v+ Pns_marquee.left=marqueewidth+8
) i: g1 H& u7 A' m7 s0 |  F' H}
& J( F: |, L4 m}
/ f, e- B1 a( o3 V
* E0 F* @) b) Z2 fif (iedom||document.layers){8 I7 k' d  \' q1 Z- F1 p& d6 |
with (document){
$ ~  X# j  }" M( Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& k' z; [$ c. _1 J+ Lif (iedom){
# J% G- E2 h. \1 |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 @4 P9 c4 X1 I4 x" D  V6 T) q6 v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 {4 x) }, P1 x4 w; Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; k2 k; l9 G% T2 ^5 n) H, y3 C- j- fwrite('</div>'): n1 {+ X* l0 `
}
/ T) v) ^  R1 i; ?& melse if (document.layers){; G! u2 ~$ _/ y& h/ l9 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); R$ j; ]0 k' X  R) N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' P3 g2 a5 s# F/ J/ }+ x, swrite('</ilayer>')
! y' S0 ~' M" |% D}, j5 i6 g, n2 M% D8 [  a
document.write('</td></table>')" g0 n, A' _* m" j8 y2 V% C
}) m. I1 I* ]) ?
}
+ ?$ [& z$ C' w$ R$ v6 D& j5 T- i</script>

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