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

|
网页之跑马灯文字特效
//修改宽度
3 ]5 b8 ~! L h+ ^& c- |2 ^var marqueewidth=300
1 C. L% y' m+ }' n! c//高度
$ d' D2 M% z3 _. ]+ t/ l: Rvar marqueeheight=25- h8 k9 L: L, X5 k
//速度(1-10)
5 [! [& l& {$ T0 d# f: Bvar marqueespeed=38 C5 ]) L9 E: P( |' b! {4 n1 E( \$ e
//背景颜色
" |! x7 u; M4 m+ ^var marqueebgcolor="#FFFFFF"- b2 `2 s, ^0 l# Q+ A
//是否能暂停 (0=no. 1=yes)?
. D$ p5 Q2 A6 t& Y9 v% E5 p- wvar pauseit=17 V. m: A6 C7 Z9 U' l
% ?3 ~6 [! r4 ]/ \$ u! `
//修改显示内容8 U& h' p' f" @8 G3 x4 b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 X0 r+ T' k' l) ]1 j, c, M7 { a# h7 i
: r3 A0 S* y, r3 l1 C/ |* t3 X
////下面不需改变////////////; ~3 G& \$ }8 _# a- m& b& v" o
* Z5 K5 K; e% Pvar copyspeed=marqueespeed
7 K+ M E8 B* b8 ~5 R+ D+ hvar pausespeed=(pauseit==0)? copyspeed: 0# c0 \7 K: j) M- z. ]% x [# D/ C
var iedom=document.all||document.getElementById; ~6 n% r* k& V* c) @8 o7 Z% U1 O
if (iedom)& E( a* n' t" w* R4 u: C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 w% ~, ]* J0 T5 ]" b3 i
var actualwidth=''
+ L: q4 ~% a' l- P! Q. S5 Hvar cross_marquee, ns_marquee
/ R4 B7 u) n9 r+ R2 H) p5 W, x' @9 w+ N4 U8 Y \1 k
function populate(){
0 d' g! J1 N" V0 K0 Bif (iedom){
' r& _/ X8 e5 K2 tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 m) H) u) h: l b* z0 F/ Ncross_marquee.style.left=marqueewidth+8
6 `' N! {/ c% M) ecross_marquee.innerHTML=marqueecontent
5 |4 @5 F- k8 Z. R; E; }- `+ t# L$ Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; E; X* E% | y1 i# A}
$ ?2 i% V* ^4 w- j- e- K/ Welse if (document.layers){
" K2 V* Y* [2 z% u& ons_marquee=document.ns_marquee.document.ns_marquee2
% g8 h- t q' u7 U7 @ns_marquee.left=marqueewidth+8/ |& J4 v" |( J |; e
ns_marquee.document.write(marqueecontent)( i8 H0 r3 x( N# E' T0 `
ns_marquee.document.close()8 g" }$ f4 y# \6 `
actualwidth=ns_marquee.document.width; A0 C) i1 e& r* Q$ d. W2 l3 I
}
& a- j# q/ e8 m7 y4 l6 ?! m# R/ glefttime=setInterval("scrollmarquee()",20)4 l9 W1 A: [4 ]+ S
}* Z0 X" v. {8 `* \$ ~: w ?- y; N
window.onload=populate# Z9 p9 A+ M. s N
- q0 l" `2 S, l% P/ E
function scrollmarquee(){" K u+ l- E6 I' ~, m% A
if (iedom){ j% E H3 s& j8 f! V% H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& Q7 [* U" G! O$ x
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; F1 }, R5 `! r2 F" p
else; W6 f, _7 t; s& V4 n7 g6 u
cross_marquee.style.left=marqueewidth+8
0 C5 h+ i! k2 D* j% U6 u& g7 f
# Q$ ?6 b' g7 f# A5 P}2 f' v( C6 e1 \
else if (document.layers){
5 I T+ n% c* R) `) Rif (ns_marquee.left>(actualwidth*(-1)+8)) q! _: G: m6 n
ns_marquee.left-=copyspeed2 q! u5 x4 a5 z! u5 h n0 ?$ Z% ~. q1 c
else
. r$ W7 K+ C8 d* P7 Tns_marquee.left=marqueewidth+8; d8 v W* _9 k
}! f( e% D' `. N
}
4 U% \- Z+ ~4 `0 [
. e7 e1 @5 _) J: \! P% Bif (iedom||document.layers){
0 G7 f* s+ X: l' owith (document){
+ e; c9 k7 D( G, B) a4 E$ ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): o0 z5 h; m( @* z0 G) O
if (iedom){
8 U) l. E6 w7 `+ dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 L; t9 z0 V; \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): w G0 M' u4 q+ |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 ^# q1 P* r- n0 B# \' H- h
write('</div>')
3 t0 Z) w6 ~' z8 T. D! [}4 o/ n: @4 I! W0 `5 ~) R& T& h
else if (document.layers){
7 p0 @! e: I+ ~+ z: z- J. [7 iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& J& W" ~7 \5 g3 I3 o- K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 p5 k3 D1 d, ]3 _* p
write('</ilayer>')
1 _" o$ V/ T% r5 u9 \}
- a0 E- {7 `( k9 g% sdocument.write('</td></table>')
: U: T: e( t. s3 S4 W6 p0 f0 }# R, \}
. v" d1 p5 v# [! Q# ]# ~! y4 S7 [}
+ N& }5 ~4 n5 \7 f0 u; ~</script> |
|