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

|
网页之跑马灯文字特效
//修改宽度
' S8 b- t. t* Q D" ivar marqueewidth=300
( q* Z6 Z6 J$ h8 o0 X+ v//高度( R" p% ?7 K0 ^$ o6 s
var marqueeheight=25, L4 n- X$ n% C" {% [# c
//速度(1-10)
B% ]- I/ q" Y; i9 D0 `2 P; A: a2 svar marqueespeed=3
f4 B" F, M+ b0 b' R//背景颜色6 _2 X4 W0 L- g) P+ `
var marqueebgcolor="#FFFFFF"
( X3 o, K. h2 o; T0 @//是否能暂停 (0=no. 1=yes)?, I8 K4 K. C% V! a
var pauseit=1) q' f6 m+ N, |) n7 o
0 `- E1 i, ?+ p' A
//修改显示内容
( T& g; a# S" {0 u+ p9 a$ nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' y6 C5 @) i2 ^# W% T
4 ?9 C3 }( \8 y$ `# U5 g8 j
/ H6 k3 P& q, k2 R; m* R% R////下面不需改变////////////3 P5 `6 O/ q$ k% G' W; N. A
$ q" {& _. Z9 u1 y* _9 \
var copyspeed=marqueespeed0 R$ q" J4 O: F( j; [: n2 o0 Z
var pausespeed=(pauseit==0)? copyspeed: 0
, q+ E- d- C' P1 w% @! G* Zvar iedom=document.all||document.getElementById
3 x1 K, i2 T- S: P& _if (iedom)
3 e, t2 J- O$ h9 z8 s- ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 S& \8 Q- s+ ?/ b2 X6 ]( k
var actualwidth=''
9 w6 l& n9 J1 H6 Z+ i+ tvar cross_marquee, ns_marquee0 B2 d6 A4 I: g& i }$ f
+ u' L! a M* X8 t. ?, rfunction populate(){
: w, q5 C* Y; |/ ?% h0 S3 Iif (iedom){
+ a) h, D* P5 o% t8 D" ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; r. ^" I0 h1 P6 {cross_marquee.style.left=marqueewidth+8$ j: _/ \ z3 q3 W- N
cross_marquee.innerHTML=marqueecontent
" q3 I% |5 C; @7 e# [' Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 H8 q, }, D6 v6 ~& s/ Q, w}; U' B+ c- n6 a% J6 f4 a+ s B
else if (document.layers){
, o% x4 ]- P. J$ x. j2 kns_marquee=document.ns_marquee.document.ns_marquee2
9 ?7 G' h( _3 v0 cns_marquee.left=marqueewidth+8/ G c& |' _8 E) x1 _* M y; n) J
ns_marquee.document.write(marqueecontent)4 q# s( u5 ]1 A/ O" M* J* T' l, Y3 G/ i
ns_marquee.document.close()
, h% X' @. W- N9 ~actualwidth=ns_marquee.document.width
2 b3 S7 e% S& ~' n/ l}; `" X! d6 Y$ |( N% A( V
lefttime=setInterval("scrollmarquee()",20)
, Q& r8 N% f- _% j4 k" ]/ Q l' f}
* k! @& r# s* H. hwindow.onload=populate
, m) }- j1 E# b8 i! R% b2 I$ P! a' [6 z% U
function scrollmarquee(){
! f, Y+ F6 Y. ]( t. Y, E2 zif (iedom){
" b o# T- G. H. ~( @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); Y, o; O; b' f Y; N" u3 a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 l: j* @+ z1 X- Z8 f/ h
else, g6 P: H" H. k4 ]6 ?6 O2 ~
cross_marquee.style.left=marqueewidth+8" ~$ M2 n* g- y% g- L
1 q( T0 M" J5 p6 x9 @ X( ^: P- h}
) Y2 J: i M2 \2 e% Oelse if (document.layers){
' Q1 G( r& g7 C8 p' y& sif (ns_marquee.left>(actualwidth*(-1)+8))) r6 ?1 Q) {6 ~# n- B4 v
ns_marquee.left-=copyspeed! K8 J8 W+ C3 m! @6 ]& S
else- j, b* Q/ u- L, x5 D/ q* U
ns_marquee.left=marqueewidth+8# @* u$ [* q. K1 i/ Y5 k
}. T g# _) B3 B9 f( R% k9 K
}
! Q @$ {- D: o1 [* o% I- X0 G/ X8 H2 v0 b
if (iedom||document.layers){
3 F6 G, g) `; l5 ewith (document){* g7 v1 z, f9 a0 M5 i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 W3 Z# m; X4 d7 F( b. ?) J
if (iedom){& z, C5 S) k, W2 }% _0 F& {/ \% q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! n; ^! g, q3 } N' w W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# k% Z1 Y; d- O: V- b- x/ `5 B6 ?5 p& T- ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ W/ I5 \7 _# ]3 O- v* S6 Z! S
write('</div>')
3 ^# a& d2 h$ \: G}6 s% l" M p8 @: u% ]: y) a
else if (document.layers){
$ s% s& i& j1 E7 ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 r2 |0 \( F( N+ Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 }# c1 x# D" iwrite('</ilayer>')
4 d" w1 d6 R" a}
; X) r& ?+ B( @, bdocument.write('</td></table>')
6 h* Q* B8 a+ d1 _# C6 ^}& R t8 ^. E5 w y: A+ {
}
/ U6 z: {" ~3 O7 r$ @: Q5 S</script> |
|