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

|
网页之跑马灯文字特效
//修改宽度
7 B( X8 U3 P9 e& c: Y9 v* j* B* Ivar marqueewidth=300! }2 Y [: Q9 a# `5 j1 P* \9 Q
//高度+ F. O2 y4 Z; v# K3 F1 C
var marqueeheight=25. k: h8 H' O' `7 j8 G1 l. L
//速度(1-10)
$ f' a# j p ~- k; q2 ~var marqueespeed=36 Q/ x# B- @8 K% v
//背景颜色
- T6 q3 ^0 I" \' a7 K, m. |) Uvar marqueebgcolor="#FFFFFF"
6 }; o6 o, m2 s( q* j//是否能暂停 (0=no. 1=yes)?0 o% }6 f% \$ P% r; K
var pauseit=1
# Y/ j- n) I( f2 _2 _7 c: _6 G+ |* O, X; {2 \
//修改显示内容2 A, n. U, h ?& Q6 ~% t/ U* C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 T9 I8 O. ], I- u- R; s+ Q8 K
' C8 ^+ b$ f" {, r$ D) X, w0 f w3 c' R, c/ X
////下面不需改变////////////
1 r+ F/ p$ d. k- G c
5 u; d, x+ i+ o5 s( q) _6 Vvar copyspeed=marqueespeed
* q' _- K* |; W/ A+ O5 |4 Uvar pausespeed=(pauseit==0)? copyspeed: 0
. ?; `4 m1 G- Mvar iedom=document.all||document.getElementById
p* C% G' q; Jif (iedom)
8 t& J+ A8 Q5 c9 a) j3 k2 I, Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! g4 o/ ?$ Y ?% X
var actualwidth=''" r( y% r5 K# y
var cross_marquee, ns_marquee& c$ O4 l4 v. j p
0 Q& {1 ?$ o/ ?1 H# M. q9 Lfunction populate(){
$ f2 z% o$ y0 v" _$ h3 jif (iedom){
$ v. P) s- U d; u- c8 ?; O2 @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& C& n$ j0 n/ `
cross_marquee.style.left=marqueewidth+8
! F2 p0 x8 k7 t X4 W3 S, Wcross_marquee.innerHTML=marqueecontent7 d% ^5 c/ S2 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ Q$ t/ E Y1 \}
5 a! a0 v% p! f* ~9 q$ Helse if (document.layers){8 K8 t1 w% S& E) x3 O
ns_marquee=document.ns_marquee.document.ns_marquee2
8 |0 Z( @$ c' e1 g# S7 p5 [, Sns_marquee.left=marqueewidth+8
0 ?% b4 ~0 [. b6 A" ^$ F0 gns_marquee.document.write(marqueecontent)
' \( \+ x! M! i8 Zns_marquee.document.close()# p( S9 k3 k* X! Y
actualwidth=ns_marquee.document.width
1 i# w0 y4 q8 h" i/ I" D' |, X}3 \4 Y3 |1 n6 D2 B" Z6 M/ d8 W
lefttime=setInterval("scrollmarquee()",20)
2 D( l# m2 T+ h7 \/ Y' S6 x0 k- E' {3 K}
. J! a% p1 ]1 g% Kwindow.onload=populate
5 a! v7 x! u; R2 |. l
+ A, e2 L2 F0 ^function scrollmarquee(){: S) ?6 ^! O1 w& y7 z
if (iedom){
# I% s9 T1 |* {+ {0 Z8 }- _5 C6 `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
z/ E3 r. \0 e- i5 e, N7 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' d! j( t, c9 F6 r6 f0 T' Z% E8 \, ]else
$ i0 m/ r$ R6 ^* u* A2 {4 R8 ccross_marquee.style.left=marqueewidth+8# X9 k! |6 P# F% W' o, `
7 M* f6 G* c* R" a6 \}
/ n* D) u+ h1 q d4 helse if (document.layers){
, p9 H$ }2 P) x( [( ~ vif (ns_marquee.left>(actualwidth*(-1)+8))0 {- D$ Y% q; B0 g8 P2 L" i2 j
ns_marquee.left-=copyspeed
6 | @5 Q2 K2 P0 Velse
/ @! H' P/ G) K7 {ns_marquee.left=marqueewidth+8
# W3 ?; S& U4 i( F+ h! Z}
4 Q* g% X1 h9 z2 _. R}3 F" ~$ L3 ]& ^3 v0 j6 c9 M
/ ^1 R6 n# C: Y0 k, m& B2 m! c/ Dif (iedom||document.layers){
2 q2 {1 }3 x/ Awith (document){
. H5 r9 d; i$ Z$ Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 _* T2 l- C( f% gif (iedom){' N8 [3 g7 U; K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 O7 o: M/ f& \: S. Y/ i$ v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; t8 \% n: [; L0 o2 M: Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' z; I/ P. x- z; Y5 X1 _9 O+ A# cwrite('</div>')
# D9 X. i' u* ^: B) P' e4 s: Q}
& j; y" g: m! i' Y: y. U! H: {else if (document.layers){: ]. v4 I. [" R; n# S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 S" ^ G$ M6 C. Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ i8 x' Z& M v: \+ X
write('</ilayer>')
- b+ b. E% d+ y0 j, i}
" L* x$ U& g, j4 T6 Vdocument.write('</td></table>')
5 @0 f2 p9 ^0 a7 s1 H( b}
) X2 K6 |4 s% G" e& v( l}
4 h. w# h& O. I7 O</script> |
|