返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 B  B* i/ _3 Z2 Q/ I7 P
var marqueewidth=3007 d6 g" z3 A7 S* _
//高度% |$ X5 U9 {6 h* H" u2 n
var marqueeheight=25& s' _4 |+ ]2 F" U; L
//速度(1-10)# ~' @3 s9 n# o( c! B1 A
var marqueespeed=3
  T  f, m: y3 z+ c  y7 f//背景颜色- n; @$ r; W! I: `
var marqueebgcolor="#FFFFFF"% Z+ l% ]1 y) v" E# T
//是否能暂停 (0=no. 1=yes)?
/ r! n( }) A0 Rvar pauseit=1) J# _5 K3 H9 b' u: D' X
% ]' q6 r7 E" U
//修改显示内容
! M' h! F  I  x7 V5 y( u* Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& Q% |! ~% D- @, {3 I* m" t$ W1 m2 _% y& L9 t  w, |7 H
- c9 m% E# A4 Q8 e/ i# p' m6 T
////下面不需改变////////////" L2 W  U! p/ |. F6 h% Y

4 B) p9 q$ p. u/ b) v$ U7 ~. r, Vvar copyspeed=marqueespeed
9 |0 l) n- I- ~2 `$ j4 lvar pausespeed=(pauseit==0)? copyspeed: 0
, k! B) y; a! a) p7 {# K3 y% A) jvar iedom=document.all||document.getElementById
/ @- g, z8 r4 f; i# f3 X0 \if (iedom)' q2 N: w' v* P3 D' U6 D* V( A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 E. g9 x! k* w0 t5 a/ K
var actualwidth=''  x8 {: C5 Y; n( C( T: c
var cross_marquee, ns_marquee2 q) N% d4 P, C5 W( L# K

+ h9 [( x% t# m0 Wfunction populate(){
; ?$ E+ M9 e) P4 s1 H2 U1 u+ zif (iedom){* f8 S# Z. L2 ^0 d5 G6 r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 [( D/ k2 m+ ?' Z
cross_marquee.style.left=marqueewidth+88 M, L. F" z. Y' i1 X) M
cross_marquee.innerHTML=marqueecontent
) F8 Z' x; i1 o1 _! E4 |7 ]# C; bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  y3 E- m2 R& u' D7 k
}
+ Z% a0 F! Y6 ?else if (document.layers){- H+ j- E' [# P
ns_marquee=document.ns_marquee.document.ns_marquee29 F/ b* O& J) x
ns_marquee.left=marqueewidth+8
; w( L* s& }) c& [9 o# @) t  r8 zns_marquee.document.write(marqueecontent)
1 Q' X( |/ r% _& k2 l$ G0 D* O5 |$ mns_marquee.document.close()
8 l" i: \2 T" \7 U) M2 kactualwidth=ns_marquee.document.width* ?" c! f1 z; a) K* g& t* n
}' V1 n1 ]5 ]; Q$ l5 m
lefttime=setInterval("scrollmarquee()",20)
" o  N. H# d. Y( w. x, a! H. }9 W}
0 K) D, p: k6 D% o& Bwindow.onload=populate  z! z9 j* @- Z( L# Z4 W- G1 V

; s& d3 O' s/ F' D2 f" Vfunction scrollmarquee(){' K9 L: Q/ G% Y1 q1 e; ~
if (iedom){
3 i1 W7 u* t) O6 s% F) zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 ~7 q+ f' g1 B- K' t$ ~8 dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; g( E1 G; G# J
else  u3 i- y. u  Y6 c& _
cross_marquee.style.left=marqueewidth+8
( D* C, y6 K, y) z8 U5 B9 b4 w
& {, t0 p  S+ a% |2 f: |8 d' @}
3 H1 B% I7 i0 H0 t5 q' felse if (document.layers){
/ _' c7 T" T& Rif (ns_marquee.left>(actualwidth*(-1)+8)): p% n( H! p) d9 t) ~
ns_marquee.left-=copyspeed
: |% y8 \4 r, C: q7 Ielse
: `3 H. f$ N* G" ?* j7 Qns_marquee.left=marqueewidth+81 Z" k" h: O- A- N% v: r& |
}
1 ^' F- i: ], i) z" t}
4 \! S/ r2 l' T; }7 T& Y3 {
+ C6 j6 `: b$ w. G. K: p/ Xif (iedom||document.layers){
* e) F# h5 P* t/ a3 P6 X4 h: E0 _1 \with (document){& Z4 @1 S) a& E3 I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 [, u- \9 i: K) f6 f
if (iedom){
: W+ F3 R2 \7 E; B9 Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); u- U8 H% _+ H! e/ V- K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 c/ `2 ?, c7 j# L: _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' s5 i' B) e  y2 T& Q% jwrite('</div>'). G. Y) p* [  G" w
}
4 W2 Y1 j! ]+ k* z  I$ jelse if (document.layers){
+ c. E, ]2 `' P$ Z2 Q, mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# t% ?# \$ @7 J' T3 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: j- E7 k0 j2 j& }# Xwrite('</ilayer>')
/ x1 y9 e7 V9 t( s8 O}6 R* u0 {7 N7 G% H
document.write('</td></table>')
2 _& {2 D' d8 O7 }3 `; P}* U, u& o' P5 g" n' C- Q
}; a6 k/ M7 }1 S1 y
</script>

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