返回列表 发帖

网页之跑马灯文字特效

//修改宽度- J# r( G: B- f; }6 b
var marqueewidth=300
. v6 L6 m  S$ X' z3 S& ?2 f//高度
" k/ t/ `. _3 P4 l0 @- ], `var marqueeheight=25
: o( q/ J  \3 p/ V. l//速度(1-10)/ h' C* O9 e6 Z6 f9 [3 L
var marqueespeed=3( z) v) ?% X. t5 R) m! C. W
//背景颜色
' o9 A) t6 [+ R4 K6 nvar marqueebgcolor="#FFFFFF"' S5 Y2 m& x: H3 M! B
//是否能暂停 (0=no. 1=yes)?
0 v3 l2 V2 g+ ~4 wvar pauseit=18 u% a1 N) F  w! u6 ]

0 y' Y/ h( Y( P0 M3 L4 s8 ~6 }//修改显示内容2 @. _, o2 v. A) n2 |/ W0 @$ I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' ^0 w3 M+ `4 S4 S3 N

  M8 d2 U3 Y  M6 O$ z2 v3 V+ Q6 g2 {% a( |
////下面不需改变////////////
0 x4 P+ |% t; P8 f0 ~6 q% w: z1 P, {# F0 q+ C/ _3 ^
var copyspeed=marqueespeed6 e/ Z; w( ]( {/ O9 P
var pausespeed=(pauseit==0)? copyspeed: 0
+ e, o- D2 J, a, B, }var iedom=document.all||document.getElementById
! n  t2 e/ L5 U1 k, Q9 Fif (iedom)+ y# C& k1 L3 {/ x" t7 k' m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! c0 l) r% ^; x5 J+ N* X
var actualwidth=''
1 P6 e. a/ o  ]2 N/ ?9 g; \/ }8 t4 |var cross_marquee, ns_marquee* S) ~* j. l, T
, R9 F4 ?& l! T- X
function populate(){
; x2 @  @& a. H: ]  Mif (iedom){! t+ ^5 L% z- P5 b0 y) q3 ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ \2 d* \' r% b6 O/ T6 Y% Ncross_marquee.style.left=marqueewidth+8
3 A8 W8 B5 u4 t) L% Dcross_marquee.innerHTML=marqueecontent
8 s& O$ ^7 I$ }; o/ Q2 _3 j$ wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! \9 l8 {/ F: O. R3 Q# \& {
}
  `% d; ]+ v, `; [0 ^9 B1 Z7 Telse if (document.layers){
8 V  C( K- f$ X+ Ins_marquee=document.ns_marquee.document.ns_marquee2
$ D* I9 X$ l& Q% |ns_marquee.left=marqueewidth+82 G4 d4 Z7 N8 n# ~
ns_marquee.document.write(marqueecontent)+ J/ o' {2 W) J. i: ^$ G
ns_marquee.document.close()% B9 i4 c4 H0 H  y' B& y+ t
actualwidth=ns_marquee.document.width3 R! ]5 \& j- X2 F5 Q6 s0 {
}8 n' {' v8 v7 d+ [" P9 ~" S" B7 L
lefttime=setInterval("scrollmarquee()",20)
' `( v8 O; Z5 Q( C# e' }6 N1 v}
0 y2 @. J, J5 E# ]3 s% g% }window.onload=populate
& M8 w6 H5 ~4 r# l! V
' z/ |- X- K9 d8 Y8 pfunction scrollmarquee(){
( R- i6 y! S# K3 S! r: s( Gif (iedom){
# K0 i  `2 X4 ^* lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' y1 a! b( P5 J+ [; V9 xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. W6 A2 Q7 K$ o6 A1 H
else( U7 B. Q, g' Y& P) n; d' M
cross_marquee.style.left=marqueewidth+8
! M# E" i' V+ I: M) U" \7 X$ k
& \' T" p( \# u3 q% h- p& u# z}: g9 I9 e/ B  F, G5 s$ Y. n4 k& j; \
else if (document.layers){
( o" r( c/ p! Cif (ns_marquee.left>(actualwidth*(-1)+8))
+ [5 |0 \4 ~* x7 jns_marquee.left-=copyspeed' S3 O+ d) s. X. }# `0 @& B' W
else' u- w7 W( M* _5 r& h
ns_marquee.left=marqueewidth+8
5 C: C" t7 ^6 l' D  q% ]}
/ W4 _( I7 S* W) y4 G9 u* ~}
& S6 W2 N# d# m7 H6 {7 ^. H" G2 ^& g8 l7 k
if (iedom||document.layers){
. O) q% N4 S8 [' _7 b/ u8 I) Iwith (document){
- z' A$ m. ?, Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): f; b6 E( H8 ]  l' e
if (iedom){
6 G' W( \" ?3 z4 c; q- K' a7 c+ mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) G9 R5 i: A1 h7 ~& x" c8 @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( _( [. }1 L! M0 e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% ^+ s  x$ ~% D5 t* ~6 T
write('</div>')
' b* o$ C* M2 k  J' d' {}
4 h" v/ a* b9 k! G7 p0 belse if (document.layers){/ h2 M1 ?9 g7 t( _5 V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% J( S  Z+ q) B0 o8 o; O6 T0 `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# K3 p% g" @% i  ^& U
write('</ilayer>')
( }$ I) b4 L( i. ]- ]}
' z' D! k* |+ V8 t# Idocument.write('</td></table>')
3 r, k& g- Q) \% X}
3 e0 ~1 F( C/ Q6 Z2 e6 C}
% }4 W1 z  s4 Z* r</script>

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