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

|
网页之跑马灯文字特效
//修改宽度
* o+ I+ I" s+ ?& V; L3 f$ B! xvar marqueewidth=300* K* k1 J/ ?/ C4 F) D- N
//高度0 I5 t, L% u s0 J( a8 _" t
var marqueeheight=25
2 i6 f3 e6 v" q3 R4 U//速度(1-10)
& V& a" ^, D! V# b8 L0 p- w# H% j1 Svar marqueespeed=3; H4 i) {& U4 H4 W
//背景颜色
8 V; P* J3 `$ e/ W; T( M, m8 kvar marqueebgcolor="#FFFFFF"
, ~. `/ T8 l+ g% E//是否能暂停 (0=no. 1=yes)?4 l1 q j. o% J- `2 n- K3 X
var pauseit=1
) @( u0 L9 F6 z& X/ g6 L, @7 h0 [, J* d1 ?! I3 N( y) g
//修改显示内容) n) b$ |9 M; A) N& g4 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 @) _2 c4 U1 l
9 j, ]9 `% ^( Y% V! Y* z
0 r5 ^( h& Z; o) N+ b1 j////下面不需改变////////////7 ?5 {5 x- D3 M7 H, e
5 m4 ]: T5 D6 d, E7 C1 }. vvar copyspeed=marqueespeed
% Q/ E- |* F; A2 Q6 { evar pausespeed=(pauseit==0)? copyspeed: 0' d3 a8 R: w+ m: Q7 E9 W+ u% J9 `- ~
var iedom=document.all||document.getElementById5 _/ C5 k# R3 F2 W, k. ^8 M- Q
if (iedom)5 F4 ] L0 D! J& h# \3 }( e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 Z, x; j, b; n L0 a, S' @
var actualwidth=''! w# G# b7 f, P0 O
var cross_marquee, ns_marquee2 s/ C6 V5 i. ~8 s9 i
; [& z2 ^3 ]. U* p* E
function populate(){
, n" d6 u, U9 O4 m- Q1 V" {, o, ^( Wif (iedom){1 B, a/ b4 L8 A. A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 m) ?% [; R% W" n
cross_marquee.style.left=marqueewidth+8
" E; x( ]( \' j" Icross_marquee.innerHTML=marqueecontent
$ `" b6 K5 c( Y! G7 vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 X" ]8 e0 w% m: n1 c% r& S" g* L
}
, I1 \# g8 v. A+ s0 @7 Zelse if (document.layers){
' K I" G. s9 S* Z8 X, D; S0 ^ns_marquee=document.ns_marquee.document.ns_marquee2) `0 A5 T, b4 X$ S) [" x
ns_marquee.left=marqueewidth+8
! [1 L' U3 S( s$ d: J' ons_marquee.document.write(marqueecontent)1 N- ~/ `. b1 c$ j, X4 Y
ns_marquee.document.close()
1 o& e0 K" v P' G9 g. g9 iactualwidth=ns_marquee.document.width$ A3 X$ W" d. S6 _4 D6 c
}- }3 D- H3 i8 w+ ]) Y
lefttime=setInterval("scrollmarquee()",20)* L* N" H- i6 P/ a" V& X
}
% R" w, N' c) z+ Y& c3 iwindow.onload=populate8 A3 Z: j: _* j5 p9 a- O$ _# {; h
S4 q/ \- U% X1 I% b; j8 y2 l
function scrollmarquee(){
2 w0 ~3 x2 D, |! t: g% `3 Uif (iedom){+ r1 M0 v( W+ [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% ~1 P2 U! T8 e6 m. T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( W& `7 M, `2 d( e$ z0 velse- h% a: ?' F; B
cross_marquee.style.left=marqueewidth+8
4 \2 q: R4 k8 d T8 v) C
' A3 q' n/ ]. q5 A( z9 G}
4 p' ~; q/ s( d( X) R/ ?else if (document.layers){+ I9 j% z0 H; u2 k( }4 j7 c
if (ns_marquee.left>(actualwidth*(-1)+8))4 [0 O% O0 r8 r
ns_marquee.left-=copyspeed$ K$ t: y# v g7 S/ @
else
$ R& f, l4 ?. _$ [7 X* a- zns_marquee.left=marqueewidth+8
0 s9 i6 Z/ `4 z}
/ [& k% m, F" n4 g% A# o( _}
8 F4 h) S( ] G. g' {/ l
9 q! R+ j/ ~; R9 T1 @ E* xif (iedom||document.layers){
7 a; Q! M$ V$ Y2 E8 s3 }with (document){# D/ y$ q6 H0 r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 I" S* ]+ G" F# E
if (iedom){
: J- {" d, N; ?& e# w+ Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! b% s; j7 Q' P. Y! mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, v6 f: }/ U/ k+ S+ H9 Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 S* f' [9 @. K3 C5 y
write('</div>')3 \# e: l, o" d1 R ~+ r( a( O0 n
}4 w* Z9 [: F2 t3 j C
else if (document.layers){5 _, A& |7 r Y5 ~. S: t' T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: U V1 e; a! D" `) R% ?2 ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* A% P# G0 W% Z% Bwrite('</ilayer>')9 o- \0 V* s/ u/ {. P) Q" e# D
}
3 n0 g; ?, C* O7 a/ d8 P. Jdocument.write('</td></table>')
3 }0 F$ @* [) `: Q& `}
5 F& g6 W8 L. d' k% W2 y3 A}
, y8 V8 v4 |3 Q9 u9 Z! r; {! C3 E</script> |
|