返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 V! u9 O* K5 S
var marqueewidth=300; r1 ]4 n  l% G) }/ Z7 k
//高度
9 R  r  `* Z8 J$ ?. J, U- avar marqueeheight=25
, {1 h$ L3 t6 @' ?//速度(1-10)) Y. p" @9 G  O8 D& A0 k! \, ?
var marqueespeed=3
3 y& _) }& c5 X. N# m//背景颜色  I2 [1 q$ D# Q
var marqueebgcolor="#FFFFFF"- B: o2 l, ]' O& i
//是否能暂停 (0=no. 1=yes)?
( t7 @, Z% E- Avar pauseit=1& d% d9 `) O7 [- c/ `

! J: @# Q8 t3 @: s" Q' X4 n$ G//修改显示内容. p3 X4 I' B) [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') r: i* @5 P* q4 p
( ^4 G% v" p7 A, M, S( Z" Z

' k5 D& M0 w$ k% S# ^8 k( v# ^////下面不需改变////////////5 R1 K7 q  v  r1 k

5 o" g- S* b7 ]3 W! bvar copyspeed=marqueespeed! j2 X* S/ Z( l% q
var pausespeed=(pauseit==0)? copyspeed: 0
" t* G- Q5 Q/ N* vvar iedom=document.all||document.getElementById2 f* `: A$ I: Z
if (iedom)4 J; [- I. p, a1 D7 k5 p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% ?7 H; S# ~+ R; t  c# {% \% J! A6 Nvar actualwidth=''. C$ g2 X$ O* e+ [; r& D. b
var cross_marquee, ns_marquee
; L; `$ i  w9 B, x$ V, q5 B4 l# |" _; q  q6 V2 M6 \3 t
function populate(){
, f- n- B& r* G  Y/ gif (iedom){
7 ?2 S! \; r; w  Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 J' a& Q! L: Pcross_marquee.style.left=marqueewidth+8
. m& q+ V/ j; @% _6 Y/ E! {cross_marquee.innerHTML=marqueecontent; d( M- t& {( p6 V6 Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" ~/ b$ `2 S1 v6 y6 ?}* s6 j5 ~4 n4 Q  A% H+ m& G
else if (document.layers){
" j% I. W" @5 }2 a# zns_marquee=document.ns_marquee.document.ns_marquee2
# q* a3 p. ~% W8 X& i0 Ens_marquee.left=marqueewidth+86 M+ _8 s' ^, C9 I* V9 j- I( [
ns_marquee.document.write(marqueecontent)
, M' E) @) i  n7 w) u' m6 ]ns_marquee.document.close()8 V/ ?" u* L  O8 M
actualwidth=ns_marquee.document.width+ I( ]: l9 m7 r' L6 H- d
}
  h+ r% o# u0 p% W% f% slefttime=setInterval("scrollmarquee()",20)
5 T4 W: q1 n! v+ K, A9 Z/ u  C}( R+ e4 u6 F4 h  ?
window.onload=populate
  E/ h5 f9 I2 d& H0 R. o; U8 I+ Y/ A# d
function scrollmarquee(){
( J( q# N( X( i. F$ s% nif (iedom){
2 f( @' I" a' g$ w: }' R6 Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 e8 Z! g6 D2 r2 c$ V6 |" |; U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ ~1 G6 x9 Z  v! D. [2 ?else
& |6 J, Y9 F3 O3 y1 Zcross_marquee.style.left=marqueewidth+8
  B3 ?# F& J+ [4 A6 O4 f% `( e, E* \* {1 y" e% B+ X
}. k$ {+ B/ ]: I1 @/ \
else if (document.layers){9 [; U2 s# L7 S1 Q. M
if (ns_marquee.left>(actualwidth*(-1)+8))
* ^' n$ P, L5 n) O! t6 Vns_marquee.left-=copyspeed4 H# }. V7 M. P2 u
else3 D, b: R# R* z3 w
ns_marquee.left=marqueewidth+8
8 l. i& D) k" G3 I2 a8 m6 ?}! k7 y0 T8 X  G& F5 c
}0 ?! `3 W) S! c0 [4 P0 t  o
8 g2 o: _& b% p% D, A/ f1 R- \& e
if (iedom||document.layers){. z8 j6 L. c- j/ s
with (document){
& U6 U) ?: U" B- ]* B4 @0 I7 Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. w5 o1 P/ `4 B' pif (iedom){3 i/ j% a1 ?# z  ]! C( P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 s4 z+ H' c: `3 t9 y7 R' z' L; L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) m) F# x( a, `. \- l/ b1 ?6 E' L* Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( r7 g; z3 F; ^% J/ \! D' |
write('</div>')7 O' \, e8 z9 e) F7 L% O/ k
}
: p4 V( o9 j. g0 z3 z- Delse if (document.layers){  ^/ K7 ^) x- e5 q& j- b, F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ [5 w% A3 s8 d1 a* V! rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ M( e) h4 b# g  K" Z1 @
write('</ilayer>')9 T" ]7 r4 A( L2 o/ J$ ^5 v- d4 q
}
; ^8 I2 r; T! B; m1 h/ gdocument.write('</td></table>')
" t; m9 e2 I0 Q2 l) D}& ^6 ?$ A5 M8 Y' A
}
) F- u: M; q+ i# [; l. I5 L</script>

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