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

|
网页之跑马灯文字特效
//修改宽度
" @$ q* c- q% }# A* g1 Q, `2 D) Rvar marqueewidth=3007 O4 F2 S2 ?0 `$ Z$ Q
//高度1 @6 F' ^- p5 Y" U2 X& @6 m
var marqueeheight=25
7 C" S3 }2 H( b; C& }) O//速度(1-10)( p* R/ y9 M6 _1 ~2 m/ d# a& j. h
var marqueespeed=3
* a7 R5 r A2 e: F+ i( n7 ]( _, y# \( o//背景颜色
2 v2 K+ ~. W- f$ x# X! Rvar marqueebgcolor="#FFFFFF"
/ |9 Z9 F* W) Q' o$ [5 J//是否能暂停 (0=no. 1=yes)?
( Y$ |$ o+ P% F" V/ v! I* xvar pauseit=17 L& B5 ?" b j, \+ K O/ O9 P
( d& q0 k; ?' j5 B, j, J$ ^) p: O- \' V# Q
//修改显示内容8 Y8 Q: g% ~( L R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 {; c, O( I2 s. D6 E* Y2 N& L# F/ A) ?" h/ ]( o% j
- c( y" }6 J: e8 @2 e0 |6 T( M////下面不需改变////////////
R- g. D1 ]. u9 `) b$ R6 H) N; W e) U( d6 z- d
var copyspeed=marqueespeed
0 e! ]1 o0 ?" z$ N" uvar pausespeed=(pauseit==0)? copyspeed: 01 }3 ]* S9 V, r6 d
var iedom=document.all||document.getElementById
o) i! ~7 e; q% L8 p% Tif (iedom)
/ c. T6 g& ?; m: bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: e3 H- q5 b) Evar actualwidth=''" P) Q$ l3 r% ?1 R# d, [
var cross_marquee, ns_marquee9 N9 Z' r9 _1 A: T2 A
7 w' {1 j, E# d' ^function populate(){
% F; P( K2 W* A" Q8 |if (iedom){: Z8 v' H+ ?; d3 M* \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 u7 E: {9 c3 E! L
cross_marquee.style.left=marqueewidth+8
- U2 M$ H2 m+ ]( B, t; Ocross_marquee.innerHTML=marqueecontent
1 Y& g& J% I( G4 Q4 \" p2 _% [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth R/ l8 m! M+ N+ [
}
# H* u: H2 s( e! T0 `: Jelse if (document.layers){
) u$ ]9 Z! n5 b& {& F1 kns_marquee=document.ns_marquee.document.ns_marquee25 A2 h# b/ [: l7 K( g; w
ns_marquee.left=marqueewidth+8
8 Q g3 G2 C/ C7 {. R/ L( K$ Fns_marquee.document.write(marqueecontent)$ q8 @! Z; m; P2 x
ns_marquee.document.close()
6 o: d. B4 w. |3 }3 yactualwidth=ns_marquee.document.width5 _. m1 |- P4 }; S4 Q7 b1 o2 n
}
* q& F" u0 f+ B8 ]; m% Y$ plefttime=setInterval("scrollmarquee()",20)
% ]: c( K+ f8 n6 y}
6 @) m' N( x: [: W2 r+ Owindow.onload=populate; u5 |* G6 d: m
7 D% k& ^1 t) O+ B& N8 |% qfunction scrollmarquee(){; z, o) K* m6 ]1 z4 r7 x
if (iedom){6 l2 m) y; J4 t7 s+ X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
n# {, ^9 n" ^8 }% scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 P1 X, j1 P: B r! |) z: delse! B; @' O8 D1 l
cross_marquee.style.left=marqueewidth+8
; u! U' N# P8 Z9 @
9 ` }+ W' \0 t' ?) V" _, v}
1 ?5 J/ q/ L. f) @: B) M) a: eelse if (document.layers){: x% {4 P4 U5 ~, X3 i& d3 j: l+ H
if (ns_marquee.left>(actualwidth*(-1)+8))8 [: k4 y3 O; k5 W+ ~1 n
ns_marquee.left-=copyspeed
: ~) u% f5 |7 x) Z; \* d: n* [else: P8 o& Q: w+ {4 A! `- y# w+ q
ns_marquee.left=marqueewidth+8
9 O, F& \7 d! O' |}
. I' K" q7 e* q3 C}2 ^' ^, f7 |2 z+ h, e
1 O {0 k1 Z. K! @% ~) `' h. _2 @: Iif (iedom||document.layers){
- k @+ x5 u# a5 y+ m# w; l. P: Qwith (document){
0 h6 V- z) o: z. [' qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 Q+ e9 @ J# dif (iedom){* ]9 [& J; Q2 D% Y$ K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& k, D1 e! b- M M8 V2 Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 h# ^; W" e L8 ]% q8 @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 k, E8 v9 V6 B
write('</div>')
+ R% L i/ f. u: G}2 g. y5 e2 B( u/ Y: b) u4 A
else if (document.layers){& C" E) x' S z f, ~+ V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 r# R# A9 v" f) ~8 s2 g7 Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; i3 \% r; [5 s8 b+ X5 cwrite('</ilayer>')
' Z/ C0 r/ |* b0 m. K5 c+ V/ I}
. M. s. ^) a4 S8 M4 V4 Wdocument.write('</td></table>')
3 [, T! c- X) \. A}
8 a' B3 M' t4 n" t& l4 C7 E8 L}
. ?5 a. Q1 c/ c. J/ A% g- ?</script> |
|