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

|
网页之跑马灯文字特效
//修改宽度
+ P; G# W7 h3 |4 Kvar marqueewidth=3003 ]# n. @# K% Y/ A
//高度
& i4 r4 c+ t1 w1 h hvar marqueeheight=25
) |6 t. g' E( s5 p" s//速度(1-10)/ P2 b/ J. A! `
var marqueespeed=3, L3 I, c ?( j1 p
//背景颜色
; T% Q, C1 I$ B& n$ `# S+ ?var marqueebgcolor="#FFFFFF"
- o. \. G, ], L! A7 f. Z; E//是否能暂停 (0=no. 1=yes)?! U2 i7 W9 J# L# R
var pauseit=1
+ u7 N, B3 N* V9 O( G4 l' _! ?5 R8 x; y. l. u
//修改显示内容+ I7 V: `8 o0 }$ k7 i: y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# M9 a9 j5 G( n5 B! Z+ p3 T, U0 y& _
, x4 T. i& {& ~5 A
////下面不需改变////////////
) l. H" ?+ m) c8 w. {! ]9 a% D
% ^8 {) |* X C8 T6 @var copyspeed=marqueespeed# P" C; S& b+ M9 i' f& x( `
var pausespeed=(pauseit==0)? copyspeed: 0
- ?1 O, Q) H9 m6 c! Kvar iedom=document.all||document.getElementById& Z. H( R( J) V+ J
if (iedom)5 L$ D. G3 o& S1 C+ s7 n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% p y! ^2 i4 Bvar actualwidth=''
2 x4 Q. P4 r8 h8 ~. k- ?& v/ F1 xvar cross_marquee, ns_marquee7 l% c- ~- E& Z1 z
5 d$ P1 z1 J+ V. ?8 i9 e4 n* kfunction populate(){7 X( w- H) m9 U B" z1 U- A
if (iedom){
0 J# B& q" \- [: N2 T2 N1 I6 V. dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& k4 r8 y0 [% p: t5 o0 Ucross_marquee.style.left=marqueewidth+8
; V/ B7 q0 ~; v/ s, [/ I, P/ ccross_marquee.innerHTML=marqueecontent3 d/ C% A* ^& f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 r$ a; m7 ^! L, d}5 k- |4 z* L7 s4 z
else if (document.layers){1 s% d x) y. \$ V8 ?/ t
ns_marquee=document.ns_marquee.document.ns_marquee23 L+ H) W1 X0 N( `, @ k& w
ns_marquee.left=marqueewidth+8
2 Y9 ^( q; B% `% z' P1 R1 v A8 v' Xns_marquee.document.write(marqueecontent)
4 n: D6 s2 E/ G5 l. H% o2 }ns_marquee.document.close()
# U! r/ K! o1 @* ?& I/ k" Oactualwidth=ns_marquee.document.width
( `4 }. V' k) J$ E* u}4 v3 N6 H# K% Z8 a3 A
lefttime=setInterval("scrollmarquee()",20)
8 g* G0 @4 o# `. o* N; A- N2 ^}
9 k; L7 B: t6 d0 ]window.onload=populate
& u+ g c7 a1 A7 ^* u/ q* ?% i, _/ ^9 J; h3 ~
function scrollmarquee(){
7 Q( ` k% j3 q5 yif (iedom){
8 L: {4 W6 F4 c" S3 gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# ~6 F, F- M# F, G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 n& ~6 U( q, telse
, a' w! k' m" ]- O P1 v: ocross_marquee.style.left=marqueewidth+8
1 e1 J. t3 K- q( K. W6 g
$ v7 m) H8 u8 X1 `4 J}
7 Z( m! O& }8 z, C6 V* A C7 yelse if (document.layers){
; \/ z& E# P" Sif (ns_marquee.left>(actualwidth*(-1)+8))
/ U( R3 L; v* O% ans_marquee.left-=copyspeed5 b7 [; x& r$ V" }4 d
else
8 r# D9 M3 E% Y9 E3 V. t6 h* {ns_marquee.left=marqueewidth+88 b" Y5 @. v0 J1 \- N( _/ a' e
}
( A' V7 g" j9 v) V+ |}
3 R* W9 D5 I2 T! n3 H, ]# `5 n4 [! z$ s* B- U
if (iedom||document.layers){
- {( }$ L f, q& D4 f' F, kwith (document){' j# E& N4 Z+ V' t p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) l3 y+ Q# p6 [0 S- yif (iedom){1 H& x. Q8 O6 e. p& Q/ P) P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). z9 s- H+ i9 Q, w/ z/ k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: v m, }( s" u; }7 C% owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') t' o% j* m2 N
write('</div>')" u! j) B/ m4 R' D: S
}: e. ~6 d7 v$ a
else if (document.layers){9 X, p/ l7 E7 L; l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 O2 e4 O! J& s5 R' f% g n) B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% i" n) @! I% Y: V; ^$ N9 {write('</ilayer>')- [$ m8 F8 r; B/ P7 [4 g
}- U' \& t9 _( o% ]: g# V
document.write('</td></table>')
/ \) z5 [' d+ \2 _3 k7 a5 p4 K}
- i: h' d) q* V$ M# A' } m; n/ K h* Z6 O}
$ y# k3 [% @1 t7 x( A0 d</script> |
|