返回列表 发帖

网页之跑马灯文字特效

//修改宽度, P1 e: |0 V( {1 |: Z
var marqueewidth=300& J7 q4 A) R% a9 \
//高度
) e4 e! ?# t5 {! [* }1 Cvar marqueeheight=25
! q- \. N: E% a' ^# q! I. ?//速度(1-10)
- e; ]4 `  x: w  Bvar marqueespeed=33 v4 j  c0 P. A+ j) O
//背景颜色
2 T2 B: P3 h5 ^' {2 W2 z7 e% R( J  R4 evar marqueebgcolor="#FFFFFF"! Z, ^% g2 e) B+ Z: a4 n
//是否能暂停 (0=no. 1=yes)?
) n9 E2 }! j1 d& ?6 mvar pauseit=1
" \+ V1 d$ F: G1 |: T
2 P. _4 t7 Y  F3 H, w! Z6 n//修改显示内容( A  k$ u$ e  d$ l$ |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 X, y* w% q# `) [3 ]7 J: L1 F
% P  P, }4 B7 k9 |9 W4 b5 Q" y
$ y1 G2 Q" d# @5 F////下面不需改变////////////
$ ~. s+ ?" |8 E$ ?
0 u" g8 d  D  S" @5 a9 Wvar copyspeed=marqueespeed
6 @0 a. M0 A0 |2 M- gvar pausespeed=(pauseit==0)? copyspeed: 0
4 k7 u" h! f4 P& [- R7 Z, G, Wvar iedom=document.all||document.getElementById
/ S5 D) ~6 F$ k3 {$ \6 A/ C' gif (iedom)4 ~8 y. c: d9 h' w9 j# O) y: K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 i) i- O7 |. i8 ~8 Q8 M" ], E/ o
var actualwidth=''. {/ S& w; X! U+ F. D2 H0 R* g
var cross_marquee, ns_marquee
+ t) N, I. {& }3 Y5 v0 n3 @
( D. s0 t# Z2 G' O1 c: }function populate(){. [, v/ W& ]$ t3 d; k3 k% ~
if (iedom){
: ^! z, I4 U7 H& Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 W/ m$ a, z$ \$ T
cross_marquee.style.left=marqueewidth+8
( k* ]3 A5 C+ r) Q3 ?# @cross_marquee.innerHTML=marqueecontent5 x& y2 ~4 G, {. S6 U* q$ b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 L0 b0 d" e7 d9 n' ~# q6 x+ L
}% k" R/ s' V9 ]- C
else if (document.layers){8 \' a  R. x, ^# B2 d+ \: V
ns_marquee=document.ns_marquee.document.ns_marquee2
* t: d4 A9 Z. K( t; D2 r2 wns_marquee.left=marqueewidth+87 ]" \3 G( b1 a/ G
ns_marquee.document.write(marqueecontent)
1 B0 P2 @, ?, T1 L- Dns_marquee.document.close()2 i" D0 H% y6 Q
actualwidth=ns_marquee.document.width7 z  H3 `$ Y2 y' Z
}
1 k7 v3 ~" b, e) r+ f  m( c' Z+ V# Glefttime=setInterval("scrollmarquee()",20)
0 S% h, i& W; [3 E( W  c, d}5 v2 [( W/ C. [) R6 }
window.onload=populate
5 H4 G# J# c+ O4 ^1 F# i' P, [3 V( a: O- S1 i3 E
function scrollmarquee(){
" e% U8 ?+ W) \; x3 h4 tif (iedom){
5 w- a& C% J; D2 A" Q4 s  fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* }5 a) Y# j/ ~# m- t( f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& {7 Y, g& \* @$ W6 Q% f+ uelse
" B; T$ Z1 C' v$ d" f" Ocross_marquee.style.left=marqueewidth+83 ~) x+ K2 a& h4 V

( K# ~3 K, ^0 r3 q/ H}. ~" f7 X& {1 n
else if (document.layers){( t0 a& c/ D# ^& c. a* @8 k
if (ns_marquee.left>(actualwidth*(-1)+8))
% x( F7 m9 ~& g0 Gns_marquee.left-=copyspeed/ }8 ]% x8 N0 q! _  ^+ {& p2 G
else
) r- x; i$ T- q$ f/ N0 Rns_marquee.left=marqueewidth+8
- Z! j6 x. T. n7 d5 D}) F3 e/ L# P+ A! w- _2 B
}8 V% ~' z. ?6 A0 m) ?, D0 k
4 ]2 u1 t3 z& @( N# |
if (iedom||document.layers){
  X7 I# Y4 |* o, w. i% Lwith (document){
% a- r4 Q  h/ f8 d4 i  }4 qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ B0 O* O# W8 O' @9 h" rif (iedom){
- E+ P2 d$ t7 e1 _* N. T' j2 \! l" g3 Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): ~% E* p% t9 x0 N3 x2 t  W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' x3 e5 c& O- H, t: U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ m1 {6 j6 N8 W& `6 B. Uwrite('</div>')
3 q5 F2 ~. q- I! J8 L& E}
1 p3 y6 H; w6 z  i& helse if (document.layers){
; l$ J! z8 l( mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% K# e, d- Q9 |* ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( L) p& x, U9 B1 r, i# k4 ~. S+ F: ?
write('</ilayer>')/ G' P. d3 w; `2 c
}+ D6 @4 s& S3 f7 F
document.write('</td></table>')* S5 U4 t/ C% I& E
}- a  j! y3 d, B& h1 m. X) t
}
; `* g, |, r3 \, d  C+ l# x: q, v</script>

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