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

|
网页之跑马灯文字特效
//修改宽度1 Y' j% B! ?% T0 K2 g9 y$ S
var marqueewidth=300! t. t( R" R( e* R" x) |" N
//高度/ c8 a: F: @: h2 m; o
var marqueeheight=25
: \$ Z; R( ~2 n9 ]; ^! U//速度(1-10)* T/ f3 [9 I) L: h% \7 P8 C/ o8 I
var marqueespeed=3
0 ]/ f* y" @& S( I//背景颜色
6 C+ _- K9 i0 z1 v, k3 |2 Yvar marqueebgcolor="#FFFFFF"
: u1 ^1 j7 d' A x, t: X0 |//是否能暂停 (0=no. 1=yes)?
% I( }; c9 S. Kvar pauseit=12 f/ P% i' ^+ w0 [1 I+ \
, T7 m. q1 _. S M S! A//修改显示内容
) b- ]4 P& |2 k/ ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') J0 Q: L" K/ R: T% g o
1 o$ C/ ?% g# q/ G& w
/ c9 Y1 T* H- \: F8 Z4 {////下面不需改变////////////
- ?; i" w) o" }/ Y5 ?0 J
6 }) V! R; k+ bvar copyspeed=marqueespeed
% h! K' G7 g6 ]var pausespeed=(pauseit==0)? copyspeed: 0
* q0 f8 g" a( n& Bvar iedom=document.all||document.getElementById! D1 e! V' G8 D$ _
if (iedom)
. r+ i' H0 [+ ^/ \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 G2 S- _' t# fvar actualwidth=''
8 j) F! P o; K5 d$ U5 |: c2 x' |& g. dvar cross_marquee, ns_marquee
9 E+ I% v. ?) o% l: c; w
- o& w9 N Y( B2 W7 Z) `function populate(){
+ G1 Z Q% |; \& d" ]7 j" e0 Eif (iedom){
3 {8 B* T1 `. X: ^! y. ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# n" v1 h L( t7 c+ J) y
cross_marquee.style.left=marqueewidth+8
4 E- L7 D+ J9 d3 O# Ucross_marquee.innerHTML=marqueecontent: o( F$ g2 a' H/ W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 d6 D8 `- I a+ i0 m
}
, K o4 ?5 m8 [else if (document.layers){
/ l4 c' }: f- J2 Kns_marquee=document.ns_marquee.document.ns_marquee2! M% C/ p% k! T9 o. w/ F& M9 [0 g
ns_marquee.left=marqueewidth+8
5 G4 I A2 K* x2 \6 r0 dns_marquee.document.write(marqueecontent)0 L: T. N$ V+ R$ m g9 E
ns_marquee.document.close()
0 [: K5 t2 Y" Wactualwidth=ns_marquee.document.width2 q0 w6 v- A2 ?2 F& R! l& u8 q
}
4 ~8 d Y* f8 tlefttime=setInterval("scrollmarquee()",20)
, K; C( b4 X* x# n: [}
! b: c/ o J* {/ Y, Uwindow.onload=populate6 \' l. P. V9 e8 G
$ V4 p% c0 H9 L. N3 S
function scrollmarquee(){
) H N6 h/ j: _4 X+ p% ?if (iedom){
9 h1 ]: t+ Q9 G9 Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 m3 ]# k6 }9 f, r) U7 Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ G" W' j+ K. _( J
else/ q1 d) k4 X" v" b6 h( @( F- v
cross_marquee.style.left=marqueewidth+8, B3 i! h4 R: u) M
0 ^4 X. @9 r2 P, ]5 u}
" b; D+ |: A* T* b6 ?3 nelse if (document.layers){$ m. w2 W) x2 P+ m2 V
if (ns_marquee.left>(actualwidth*(-1)+8)) {" B: ~6 h2 s8 }! F- t" \# s0 s
ns_marquee.left-=copyspeed/ e+ k" g6 A! ~7 g7 ?
else- ]% _/ c2 `8 t8 ^9 A
ns_marquee.left=marqueewidth+8
; \* l$ v) {1 S# O}
, R9 U3 c( g9 t}
; T+ \' Z8 z4 G- p. f. ~* t: A, \5 [- Z
if (iedom||document.layers){% n3 d# ]7 S) u9 Z
with (document){* ^5 X* Q) F" _) q; I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: s& }* V; G% ?1 H, J% r9 R+ r! Z1 Qif (iedom){$ A4 V/ X" @% B+ R" g9 c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). t/ u2 v, J4 t% z1 z5 o v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- s6 m( C8 `4 v5 }7 Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 L' i9 ?6 n& z% O
write('</div>')
, Z" q) L- `2 o" P7 O4 y0 O1 T}
S+ x0 l- [* }* f nelse if (document.layers){$ g- G/ x- u* v- T' m# P. e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" @( K( I& \! H# h; Q/ _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& S3 z6 p1 i* d3 ~9 t+ X
write('</ilayer>')
* q# a4 q' v" N# o, v}' D6 M1 p$ R) p6 P
document.write('</td></table>')+ G( B; b0 Z5 T6 Q. b! L1 _
}
7 o& C9 ^+ R1 S6 P! i7 U}
( l2 E7 B _+ x z3 u</script> |
|