返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 U% i( K; f% A3 _8 C- p( W6 Mvar marqueewidth=300' f/ E. D* r. {5 n
//高度
9 i# i8 \0 E! W# ~& c6 W' d* M. Dvar marqueeheight=25
: i5 G1 d& o1 _- r/ q//速度(1-10)$ @2 @5 s5 Y, q2 d% X2 W
var marqueespeed=3# M3 T7 @8 g# y+ s9 Q  ^
//背景颜色2 L" T- i' v* n+ R% I3 W" E
var marqueebgcolor="#FFFFFF"
5 e& u: a3 K4 U! K8 Q1 J//是否能暂停 (0=no. 1=yes)?1 g% s' k# g7 |
var pauseit=1
% V7 \) u: w0 I7 |5 C. ?9 O9 {  g
//修改显示内容+ _8 d$ e8 G* P+ e1 u9 H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  }' g( K" V! a. t* I" }+ E' g
+ H9 o% \  i: ~& \! [" O% s; }. `
% ?! h# \: ]$ J. l& B4 Z" T4 R////下面不需改变////////////2 E: Y( E; A1 p0 _

" n+ D" A/ R; B- K& Q! ?; Lvar copyspeed=marqueespeed
% c) }5 R6 U. {* lvar pausespeed=(pauseit==0)? copyspeed: 0
8 }0 n; [# ^6 c0 I# \( M# b: g, svar iedom=document.all||document.getElementById' u% U* R; v1 m" S$ B! |2 G- c
if (iedom)0 _& W  k; p/ J5 |7 B( G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 @; P% }1 d- o5 o$ J2 Qvar actualwidth=''
$ S3 O" ]2 W' Kvar cross_marquee, ns_marquee
# |! Y5 i9 B) e! s
8 S5 z( _* U) X6 K" U* hfunction populate(){) s, Z: P4 U8 |  K5 i: M
if (iedom){
# J* C" @+ m4 T) B$ I  Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 ]5 `% @1 T! t" c  H
cross_marquee.style.left=marqueewidth+8! S8 u5 q3 Z& q  `6 X
cross_marquee.innerHTML=marqueecontent
# k" `. S0 O# F- ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' S4 z/ r5 z. Y  N7 D}
+ ~) l- r- T3 s' ], h/ V/ gelse if (document.layers){
: f  s) K. c8 b6 Y+ c' pns_marquee=document.ns_marquee.document.ns_marquee2
; l  ]7 l' f7 r6 @ns_marquee.left=marqueewidth+8" k5 O( Z. `0 o0 |: ^9 ]& \
ns_marquee.document.write(marqueecontent)
3 s  x) G. L: U& V7 }ns_marquee.document.close(): f8 c% |" m; @' C
actualwidth=ns_marquee.document.width* r; j4 Q0 u6 n  Y
}- H- d. c7 U- j" O! O& r, m
lefttime=setInterval("scrollmarquee()",20)7 @0 Q' p* P" w2 u' j% R
}0 m2 b5 y1 V7 I% M
window.onload=populate
$ o8 C+ N/ H, g2 B% x7 ?5 A$ c- X( ?: ]& c% y
function scrollmarquee(){
& G; m' f4 v! C3 w2 w7 Wif (iedom){
/ ?5 }, x. _9 \8 @0 n4 ?  kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ Y$ f1 n. K3 K- u/ p% vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- o* Y$ V: q' S8 m
else
  n4 a& P& G- X6 _  pcross_marquee.style.left=marqueewidth+86 G( V  a! W8 _7 X0 Q, u1 O
- Z; q+ |5 m  w# m# d5 h+ E
}3 x( ~% v; Q) z3 t, o
else if (document.layers){
, Q% b7 W+ ~* uif (ns_marquee.left>(actualwidth*(-1)+8))
0 w5 V* H; D# b7 S% W4 j1 |$ wns_marquee.left-=copyspeed9 y! w+ I' T" T: B+ D
else$ }; t  i: U# l
ns_marquee.left=marqueewidth+8" t* q( r: O, D& f
}
* W. |7 ]. f. r- t2 F4 P- ?0 S. x  C}; q* a+ D& g) V2 f, A
9 g: W& T. u5 x
if (iedom||document.layers){
( j; o4 E" o7 T2 u2 Y7 _with (document){' Y6 o, Z( V7 W" `9 n* n# H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 y% c0 y- g; \- b0 Xif (iedom){
8 L# s. P( Y1 b/ S4 wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 J1 W- ~5 f+ q5 Q5 W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. p4 J4 J) ^2 o6 f) j9 l8 gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): E6 p2 J: g. K$ k. d
write('</div>')! H  ]; ?* h" B& F) T% z3 y3 O
}# Y( |$ a: _9 t$ W! F
else if (document.layers){
  B1 k0 e# t; h$ Z2 l, V0 @; \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). r7 N# b) _- [5 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, T" @0 x  Y- Q7 r0 o$ U8 Cwrite('</ilayer>')
! y, N* _: t$ h6 l% I2 _/ X" d+ K}0 ]2 C# C7 R  |* k# v
document.write('</td></table>')  D. f: G5 x. A2 c( N1 r- v5 f) Z
}( i% @9 f: |8 W7 q
}
, @1 J9 l- K: H3 f. f' d</script>

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