返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, G) m1 K: E# y; Cvar marqueewidth=300  v1 I, ?2 R4 g+ {% P
//高度
  S# Z6 X) V* g- Q3 E4 g, J/ Mvar marqueeheight=25
" Y3 h5 O5 B, M, G. o* r6 d//速度(1-10)  ?/ E0 N+ z# K& d$ K/ o
var marqueespeed=3
) Q& N  A2 z# j7 J8 j//背景颜色
; o7 }9 R% d! R! k/ d$ ]var marqueebgcolor="#FFFFFF"
; L8 f+ M5 c- c7 e# X  B//是否能暂停 (0=no. 1=yes)?5 t. D  h0 \- L0 n7 n. ?- B
var pauseit=1
7 \# x; ^/ O4 V" s) g: N: A$ P; q) I* V4 `9 s  x
//修改显示内容
# v! K% y3 ^: b# b/ ]4 e% {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* Q4 d& ^. ]  A
( S3 R1 w' C9 l1 f
* h, p+ h; g5 J: y
////下面不需改变////////////
  U0 _1 B5 J% K# L7 C* ?/ X  v0 }1 q3 ?* U3 W0 a! t
var copyspeed=marqueespeed
  j/ X9 k7 K) G0 xvar pausespeed=(pauseit==0)? copyspeed: 0
8 q" `6 c; p* O, C/ }var iedom=document.all||document.getElementById- s' a  f5 u: F6 Z
if (iedom)* g7 {; v) D1 l) I# @7 \7 L, f; a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ n( c- ?" ?( W% E; B9 T' P0 w4 Cvar actualwidth=''( j. m  P) O) m, g5 \
var cross_marquee, ns_marquee
7 \) U- n0 |. ~, W' _% g* J
3 {- H" v5 E& S0 gfunction populate(){: R; s. H0 R) U( _
if (iedom){) R2 o1 O' A+ @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; r. N1 [. M, U% x- d3 h* e
cross_marquee.style.left=marqueewidth+8
/ W7 |! P0 C% v' v6 J6 wcross_marquee.innerHTML=marqueecontent+ @$ R) ]/ V& r3 N8 U( ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, U: B! N. l3 n( b5 i}# {' D9 _. l; t" C0 K$ r9 F1 Y
else if (document.layers){. X2 R  o2 e5 h4 M
ns_marquee=document.ns_marquee.document.ns_marquee2
* y6 l  @2 k3 q" Y- l: W1 vns_marquee.left=marqueewidth+8! w7 o' r+ _+ m6 U3 G
ns_marquee.document.write(marqueecontent)  c$ C( K* @- a7 P( q% s
ns_marquee.document.close()* o# J7 q% u2 W; V
actualwidth=ns_marquee.document.width. W- z: \# g( F: @
}
" _6 @/ A$ K! t8 u8 j) I7 o  `lefttime=setInterval("scrollmarquee()",20)
9 L9 h; U9 N8 E1 q; D! ~}
6 g" e. v4 z" G  x: l  [/ lwindow.onload=populate: Z# |1 [& j8 ?' J, K; ?" X2 D$ f+ w% L
4 I% G- z) x/ ]" E6 O- x/ E8 r
function scrollmarquee(){
8 P# P' v  g2 Y, ~7 `if (iedom){$ {+ T* T3 _" _6 F% l7 B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( q1 H2 ^7 \0 m* h2 dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, t5 X; A8 ?; n$ t' X1 W4 L
else
# H: o. C! W$ _- j) lcross_marquee.style.left=marqueewidth+8' T7 i; N- {5 V8 f( Y$ |

" ^7 p$ K7 [; Y) j3 O7 y" N}7 D0 Q6 z0 Q; A$ m
else if (document.layers){
, T" X7 Z& ], T' c! Y/ ~if (ns_marquee.left>(actualwidth*(-1)+8))
  {- W' @% @$ B: E# @" _8 @7 Ons_marquee.left-=copyspeed
, F; q. v1 Y  M1 p' selse# |% X9 D; T. v2 I, F- D/ Z
ns_marquee.left=marqueewidth+8# j5 f4 r4 b- t
}
3 X2 F0 ]3 w3 x8 S}
, k' Q/ L5 b' T# A9 B* h+ b2 L1 O9 M( B9 L" |0 L
if (iedom||document.layers){' T, L1 F) E+ h# Z8 z4 \# @
with (document){
6 I+ r1 P# H/ n  n$ Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% _) I# v8 m+ p9 |2 I6 l# Zif (iedom){
5 ]+ B6 \$ s5 o) n. m3 G+ C/ h; y3 qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). o& @9 L% i7 T1 q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* D) c/ O0 ?8 z1 n) @* y- uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) n5 D# M% r$ S
write('</div>')
6 l& q! [1 g% l( |! ^9 l7 Z}+ l# y* E4 }% s( e& z- V
else if (document.layers){
6 {+ s* E$ \; R3 V8 L& ?write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 j; z. `+ s6 E9 q& x" P" Q' k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ t. d' ]4 v: T+ g' u- s6 B. [6 b! pwrite('</ilayer>')
# P3 z0 ?& d2 G; L5 h}/ h! R3 o: a8 {/ C
document.write('</td></table>')7 R. s5 e7 t  y2 T5 J4 R+ r
}$ l& c* }0 U' u: D1 K; Y) V
}
2 a! |8 |$ Y9 G( S8 w</script>

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