返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 E2 G6 ~4 |" e! f3 f8 f3 O% X( o, J% uvar marqueewidth=300
; J/ E; y+ j; S9 i% e: b6 r//高度
- r  ~5 S8 T6 e$ z8 jvar marqueeheight=25
( d) L. }  T2 ?//速度(1-10)
0 P2 Y' U: T0 ]+ d/ @: ?+ ]" Kvar marqueespeed=3
* g1 [6 F% @3 ~, a' v: h# h//背景颜色5 L" G& D5 X- L' h
var marqueebgcolor="#FFFFFF"6 T6 V* \9 y- y) @6 ?# E
//是否能暂停 (0=no. 1=yes)?
' X# ~! i# x0 ~/ nvar pauseit=1
0 W( D) X4 _" S/ n  s5 h- [. @
1 v" M. A2 p. u1 a8 k6 `//修改显示内容
4 P3 _8 v2 s0 P+ L1 C' Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" w: w, u) }( o! B( b
: |4 E/ |8 @# I8 B% o  h: L$ W% ^
////下面不需改变////////////
! c9 ]0 u. H8 k+ k  v& w; }
0 s$ H0 l9 H, s5 a0 O% _var copyspeed=marqueespeed9 Y) X0 R; N  r4 k# X
var pausespeed=(pauseit==0)? copyspeed: 0. M- Y5 J, E& ?' e  p
var iedom=document.all||document.getElementById
5 t5 }' t3 m6 x& k. Eif (iedom)0 A* M4 e; v9 f5 B* A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 d3 i1 |, Z- _. X/ Evar actualwidth=''3 y+ c; S9 b9 a4 m
var cross_marquee, ns_marquee
! w: L: C. C2 `
) U4 j9 I8 P% ]( L: A' V; s6 Lfunction populate(){
& ^' e) p: U! lif (iedom){
, |$ ?5 b8 H4 z) j: Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ Z; j/ |1 r3 a% Y0 [/ @/ o" X, \6 h
cross_marquee.style.left=marqueewidth+8
0 G8 L7 |" \5 C& z. u( Vcross_marquee.innerHTML=marqueecontent% Y  p5 J8 Z1 q- Y; P  c% N: H. i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, A5 D1 I  W* a) y! T/ _  p6 t
}
: H  l" @1 e, Nelse if (document.layers){
% s3 `2 N; `$ lns_marquee=document.ns_marquee.document.ns_marquee2
8 E- e" e4 C6 ons_marquee.left=marqueewidth+8
4 |1 y7 ?  O( \% ]% ins_marquee.document.write(marqueecontent)
$ O' E& t5 M1 b0 U  e& z: Ens_marquee.document.close()0 q+ f" T& [  J, P* X; a
actualwidth=ns_marquee.document.width
* s4 W# J# V1 x0 X) k, r9 c}, \3 H4 T( K4 M6 N" ?: J8 Q/ p
lefttime=setInterval("scrollmarquee()",20)0 Q6 e" n9 k, f4 @# |
}
, ^2 j: L$ r! S1 ]. N4 m: L. xwindow.onload=populate4 X# c$ N5 D. ^7 [  v

' J6 ?2 l* O% Vfunction scrollmarquee(){1 K/ F- h" ^7 r* x0 `
if (iedom){; C, `6 r! G6 q$ v# B6 D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* r/ M2 X4 b7 \$ J* Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* h% v8 }5 d/ H9 x
else
" X* I, T$ r1 |5 ccross_marquee.style.left=marqueewidth+8
; l( |' x# s! x
% d3 k6 V2 V4 X4 @5 S& ^( q9 z}
" I6 l5 s2 _4 j+ E8 yelse if (document.layers){
3 I# O: D/ A- m( l( R! T9 aif (ns_marquee.left>(actualwidth*(-1)+8))( z! X" z# Q0 Y% N, ]8 X# ~
ns_marquee.left-=copyspeed
- B* U0 v% Z" K; {9 z0 aelse
7 D2 f6 A2 I1 Y  w8 r, Fns_marquee.left=marqueewidth+8
3 P; [: y/ w1 \9 L1 I' Q& W1 a8 r}$ N; F% U3 z5 {- z5 j8 g+ _9 s
}9 Z4 S& e* \+ P* {: ^. ?% o
/ F4 {9 P* T5 I2 d0 w) \; {: ?
if (iedom||document.layers){
4 ^( j. p# Z2 d( V4 p& b/ P2 a( _1 Hwith (document){
4 Z; f6 a! p; ^' `4 `- Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 k0 D) ]) |) Y
if (iedom){2 R) d6 r: Q8 w2 O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 G. H7 z/ [* V' R0 S# cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 z1 p: z3 ]4 ~$ X$ H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& c+ B- |" w/ _5 {" i, h: ^
write('</div>'), }/ }9 W: Y, e. X
}, [1 }4 f. V6 Z3 {* `4 H* ~
else if (document.layers){
- A7 K  I" _- Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* u4 r& R3 A/ Z1 U9 q" awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' S2 p9 z/ j; A; z
write('</ilayer>')
: h0 O) k+ E# D7 e/ @1 N}. A! c' f- K  b
document.write('</td></table>')
! L) ~6 O: `- f6 o. N/ }}/ M6 a0 V' j' e4 {
}
2 g; v) C0 m; P: m3 |</script>

返回列表
【捌玖网络】已经运行: