返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 i% x$ Z' N2 _. ~3 Vvar marqueewidth=300
  l- x& M5 |6 H" `1 o3 `//高度
$ w5 Y0 r3 w5 o# L, O6 ]; }var marqueeheight=25
- L3 g* Z( ?9 _8 s1 M& M. r# D/ X//速度(1-10)
8 G3 x' c& h, D2 M+ a" I3 B" Ovar marqueespeed=3. m, K1 @1 y( l# ~1 s& z9 w
//背景颜色
/ ^3 o1 D) a5 k. k0 Uvar marqueebgcolor="#FFFFFF"! u% y4 d+ F# Z" L/ i
//是否能暂停 (0=no. 1=yes)?0 J3 d. c# t! F. O
var pauseit=10 q/ o" m% V) Y, M7 O8 Q
$ _1 z, Z" z) m: t: E. i
//修改显示内容
. B& q. Y4 ?8 D: Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; M  O% E5 L5 V9 q5 N
. j6 O: a4 R# M: b! m3 a' L/ q  V. [4 v  Y; f9 z! |# Q' m
////下面不需改变////////////+ e9 P: r- g0 g* K& C
) @0 Q+ r1 J/ D2 X0 f9 _% g
var copyspeed=marqueespeed: m7 I5 s, k0 S
var pausespeed=(pauseit==0)? copyspeed: 0. N4 Z% }' M' I; y
var iedom=document.all||document.getElementById
( n! w6 z$ E& Gif (iedom)
+ u- Q: a; y9 M) qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; \: O( S$ l7 pvar actualwidth=''3 ]* |- N2 Y0 r
var cross_marquee, ns_marquee# Q5 b  F" k3 F4 J! ^) I: |8 ]  U( t

8 R0 D+ G2 `0 d  K+ Tfunction populate(){5 b; V1 j& J2 ]; c
if (iedom){
! I+ g& D" _0 h) {cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ |6 U9 w" E2 P7 m, l( n" g; Wcross_marquee.style.left=marqueewidth+8
/ {# |4 h% y8 `8 d# `) i! Ycross_marquee.innerHTML=marqueecontent- j: z3 Z% R; M6 }" \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 E7 M0 ^  r; `; y1 i7 n}
) A1 g- J' R2 N+ Melse if (document.layers){
9 ~9 z# U2 |' D' w3 bns_marquee=document.ns_marquee.document.ns_marquee28 q1 w( M! S/ n( s
ns_marquee.left=marqueewidth+8$ e+ {3 s+ C5 }: t/ P& P* u- L
ns_marquee.document.write(marqueecontent)5 J& \" y8 J& d
ns_marquee.document.close()
4 \( w2 m6 p! s2 F! G  Qactualwidth=ns_marquee.document.width
6 t# h) W- o5 t* i% q- K# k}6 E6 }3 i% S  V* u% q0 ]
lefttime=setInterval("scrollmarquee()",20), w2 q) u2 |# ^( C2 q% [3 \3 o1 D
}
& X7 ?$ K, g' E: o, @/ l* U, \window.onload=populate" Q4 `" [2 J, R, L

+ N$ M4 U. w2 afunction scrollmarquee(){2 [; F3 ~0 _; R4 c2 |$ @7 d
if (iedom){9 E* {$ a; S8 u% h+ K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); A  J4 I3 t% n- S# }' s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 ?* R% D1 N# U: g4 ~# S6 n+ M# z  Gelse
4 z( H! p! C8 N" v# _) M! i" Gcross_marquee.style.left=marqueewidth+8
$ k' d9 v/ X/ c& j( i! P/ g7 j% ^: r! i3 ~& W1 n3 p3 j
}+ |8 f7 {, Y, D: P$ b5 ]
else if (document.layers){
/ H! W' J5 o8 }if (ns_marquee.left>(actualwidth*(-1)+8))
4 g  v& s" i9 {7 w. _ns_marquee.left-=copyspeed2 x' H5 U9 {1 q8 l
else  R" |; P' L4 M1 s+ h  {. H
ns_marquee.left=marqueewidth+8
0 j. @5 p8 j! p8 ]}& Y7 G6 O7 |+ D2 v7 A$ v3 H" c
}
: r: R7 F" b5 u7 v1 w
8 v: N9 Z: H8 S" f6 qif (iedom||document.layers){
" G  v' C) P  Q! u' V1 ]* D' Jwith (document){
% O) N4 E$ [9 F8 H8 h: x* Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* j/ e" h4 j6 y$ aif (iedom){
; g/ _5 f0 b: S$ Q# X8 lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 P3 I' R& ~2 u' V7 p, V+ Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 V% x0 K+ l7 y8 ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# x- m. ?: Y+ H% ~& G( V" L
write('</div>')
8 M. D+ y: Z1 {# m  M/ P6 }& M}) b5 `5 |3 h! S
else if (document.layers){
; m9 ]8 H3 B9 K, u9 r; Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 C, @6 w2 x$ M$ T% Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. Q& \& `  s: a9 u( Vwrite('</ilayer>')
. C5 g/ {/ a- x# }8 s2 _: W0 ], _}/ ^& N1 s1 o3 l( k$ G# m7 O
document.write('</td></table>')( J. N  I( h- v; F/ G
}
! i1 w" I9 ~$ Z7 F}4 h" `! Y$ ^% ~6 O9 k
</script>

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