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

|
网页之跑马灯文字特效
//修改宽度
7 m, x, O. K' v+ F" qvar marqueewidth=300
7 T/ `8 k+ ]3 [$ X! k" X+ k//高度
7 I5 m2 K# P2 D, {9 A8 wvar marqueeheight=250 v8 }1 v) R; u& R' e
//速度(1-10)9 x; L" \6 t/ {3 F9 x$ I; H# M
var marqueespeed=3# l5 q+ r# q: S) H
//背景颜色
% {0 K; F; G$ Ovar marqueebgcolor="#FFFFFF"
, i6 | S* @- N: d8 j7 c f+ u//是否能暂停 (0=no. 1=yes)?$ i$ ]6 X& r6 _4 d
var pauseit=1, x. b. A1 O/ b9 V
8 E. v) z4 ^& |3 Q4 f//修改显示内容
- K7 t8 T7 R Q+ Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 p8 f; m, n) M, I' t$ A& {" A, G
8 {" v! E+ V; K# p7 q4 B
& @. O2 C% x0 |////下面不需改变////////////% L2 I) K T% u$ ]4 t
- ]% T* K" I7 a$ {/ A# kvar copyspeed=marqueespeed
2 G' S5 L# e" |: h& a: jvar pausespeed=(pauseit==0)? copyspeed: 0' I$ q8 m$ }( K# X0 a) _6 V
var iedom=document.all||document.getElementById$ ]7 [9 [! W* F' x8 z/ O2 s4 h
if (iedom)2 [/ j8 H7 ?3 M+ Q9 ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), D# Q: _" F* v$ w6 d3 K
var actualwidth=''
) X }; l9 U# _. _3 Zvar cross_marquee, ns_marquee
2 z; z+ R6 {2 g8 t9 e2 E2 I
. X, B0 A+ U+ E8 u$ I* C( hfunction populate(){
8 L5 Q5 E- I0 H. ], x/ Xif (iedom){1 @8 K5 ?3 J3 F5 o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 C! t' t) V% K, [6 K5 e! N0 @
cross_marquee.style.left=marqueewidth+8- G0 Q" q7 q: D1 ~; I2 Y5 ^8 Y
cross_marquee.innerHTML=marqueecontent
/ c \! ]* A5 w' k" mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" R. {: Z4 [+ S; [" P! l}
+ v5 v; p$ r. D C6 i# welse if (document.layers){9 Y: J; K. g# H' g# p6 w
ns_marquee=document.ns_marquee.document.ns_marquee2
3 J* o' j) N9 @& Ens_marquee.left=marqueewidth+8
% k! i, d5 x; ~5 m: n( jns_marquee.document.write(marqueecontent)5 r* @+ N6 h' w7 j9 j) `4 D, T1 B
ns_marquee.document.close(): @. q2 R1 K" S2 c4 f- }
actualwidth=ns_marquee.document.width
3 t; c/ Q$ O8 T, D' U" [/ L0 T}
9 Z) U5 P9 i! T# n: O- T0 E4 y( }4 W# }/ Tlefttime=setInterval("scrollmarquee()",20)
n$ ]$ O i% O2 K1 E7 Q}& X& ]+ ^" b- a5 O. E' Q
window.onload=populate
* k5 n" \% d9 I; x/ s6 A
0 n- J. x1 q% P6 ] d& b4 ~- Mfunction scrollmarquee(){
% G0 e8 [6 [0 rif (iedom){2 D# \5 M0 W/ n. y$ x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 f5 L3 S# w" U, X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
`' x- e7 x- B" W. A& Q( z' lelse
( b6 b; ]0 I6 D/ e! m" l+ V' Ncross_marquee.style.left=marqueewidth+83 o7 Z8 j, n) [) }' J, j# s" D
# D5 G; [# @5 q% t3 ^
}5 S8 k! a" s9 B7 ^) k$ h; v
else if (document.layers){5 o/ P9 |( ^: |. z$ x( A$ z( L
if (ns_marquee.left>(actualwidth*(-1)+8))
6 f: B& W9 f1 @ns_marquee.left-=copyspeed
, [ `7 ~+ s* b4 A, a) Melse
/ N- B, I) Q) @: ?' ?5 h* M5 Zns_marquee.left=marqueewidth+8$ \& v- |0 h( `' B2 c9 T2 p4 Y
}
9 ?# E: |* b6 n) f}1 H4 K4 U% R8 E- l3 w
1 Z8 E4 @% K' G0 E6 V: D
if (iedom||document.layers){
! g( D$ v/ o8 e5 j u2 r! B0 s5 r6 Owith (document){
* `6 R- c5 e* ? b6 w) J6 Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ a& n) W5 j! ?# M6 d2 Hif (iedom){ ?/ ?; \+ d5 C0 ` T" t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 _" u0 |* X2 ?. ?4 k; {' D, M Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* I7 ^; B8 I9 {9 Z: S2 j+ nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ P9 P$ F1 {0 o) Fwrite('</div>')
! l* j4 B8 q$ P& a" p2 m' u}% w8 c% U! w p; H0 f7 |5 k8 o* F
else if (document.layers){. ~! ~+ s% U- e9 S; [7 e' f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): X% }5 Z! n5 W* M8 s4 v
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 c" \2 Y, I+ i$ swrite('</ilayer>')
/ n: S' N# G8 B9 V6 {& ^}
. h+ @. R: |' G' V1 M" a kdocument.write('</td></table>')
0 Q& p/ b) X: W' |}
5 v# `% Q2 J$ t}
0 i7 }3 ^0 |! ~) Z- \0 K' Z</script> |
|