获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 N4 n" Q$ U8 m" @1 ^+ d8 c3 E
var marqueewidth=300
# E" n6 Q' Y' `; h//高度+ t( F9 \% H1 _- Y/ [
var marqueeheight=25! C- ]4 N0 P  Y4 Q+ D4 G( n
//速度(1-10)/ A* i  N& {% M3 U- i, e; A
var marqueespeed=3
, v1 S( \8 ~4 @. Q) {+ D//背景颜色
7 m9 X6 r% d) u* J" x+ u6 r/ `# x, xvar marqueebgcolor="#FFFFFF"
+ \# M+ U1 p; f4 L5 X8 p//是否能暂停 (0=no. 1=yes)?8 B3 g7 ~0 f( B2 V3 \, u1 Y5 j
var pauseit=1
$ w& S' O2 R: ^# S+ Z4 M. T. j: I% f3 M) a
//修改显示内容
; `, a3 ?. i" x' Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& H; m+ e* d1 o

* \9 R' I7 w. d5 r. ]. b( e+ |+ _% t
////下面不需改变///////////// L$ X, Z" ]# Q

' J. X  r, ]5 t1 z5 Q+ Wvar copyspeed=marqueespeed. M$ t7 V! O( Z8 P
var pausespeed=(pauseit==0)? copyspeed: 0# J: [# i# N1 ^, V
var iedom=document.all||document.getElementById; {* R/ ]; N5 B, ~: ?; Q
if (iedom)
2 n' t  y- ~' }2 m. F" ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 P8 u, o! |9 Y( G& z$ @5 X
var actualwidth='': H* H1 t  R. k
var cross_marquee, ns_marquee
- s. W1 x1 X7 O2 b$ W
3 ?) G- I7 n4 D" H- c% h: z7 s9 Ofunction populate(){# q& U  T; h2 }% ~4 ]
if (iedom){1 R9 u2 v. O( |5 z+ r' s8 K- b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 [' u* Z* g1 l% Ccross_marquee.style.left=marqueewidth+8. |. u: Z- e% t6 _3 s
cross_marquee.innerHTML=marqueecontent
, @5 [* C1 n% P3 Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; X, w% G1 S* h" k" }  T; a* ~" }1 h
}
/ S, d* ~% A+ I( E6 t) u% f4 delse if (document.layers){; R+ Z0 E( H) g! T5 a+ z1 W
ns_marquee=document.ns_marquee.document.ns_marquee2/ }7 d7 J3 A% i) T( B8 W% {2 t8 W! |
ns_marquee.left=marqueewidth+8- }1 V* @  q% A2 P
ns_marquee.document.write(marqueecontent)+ _8 H2 A) Z+ C8 \" L* p
ns_marquee.document.close(). J0 t2 M- ?9 Z9 v
actualwidth=ns_marquee.document.width
2 B! u6 F' V) p+ I+ j}
+ N" G- o+ z8 g& I7 ulefttime=setInterval("scrollmarquee()",20)7 w, G# ?& K& B' O  u/ H: G- }* A% V
}$ B5 X) `2 n- N' u3 M# l: f
window.onload=populate7 u# x9 O8 Q  o9 V( r

" N8 z3 `- z+ U' Z# Jfunction scrollmarquee(){% R  r) m, |( U* w
if (iedom){
* }% D( R9 B2 A" f6 Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), x" w1 s& q. U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  |) R" I- d+ k& L* z" Ielse4 U: P6 a  }- B) L$ q
cross_marquee.style.left=marqueewidth+8
6 V" ?  V, `, n: S# ]. s  i( z+ D: t0 @
}
: @  \& j: W5 Selse if (document.layers){
, n  m1 I6 r' P* m. ~1 eif (ns_marquee.left>(actualwidth*(-1)+8))
% t1 E! B  L  j" Y& ~* M; Fns_marquee.left-=copyspeed
! ?& D3 H4 f, s" ^else) v/ [9 u: n$ F2 F. J2 S/ [
ns_marquee.left=marqueewidth+8
' E+ Y& Q+ [$ j* |- P$ o8 V. G}9 Y3 M7 `9 w5 I- d' K
}7 b6 J7 U  f. g

  C5 S0 M: ]0 J+ B( B, b# f' ^5 Gif (iedom||document.layers){
( l$ \# c. `1 ?! X% `! Pwith (document){
3 A' L0 ~  f* x2 Y3 }" Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  P8 I. J5 L. |5 F0 u' U9 Kif (iedom){
. E4 v: F4 x+ h) m& ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. T. R7 [! B6 c1 a; m7 B+ F/ ~8 _( _6 a( ~$ bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- P( X! k8 a1 A8 [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 K' f8 m, M! D4 Vwrite('</div>')
. w# R8 O; m9 L7 U) B- r, j}
% X. z, J) }5 ielse if (document.layers){0 O: q6 G( U( V6 t) |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' k# ]" K# D) F: f7 uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! n6 U& v9 k. Z3 Y0 m' x, {/ }% |write('</ilayer>')
! C# \, i2 y7 ]# j9 S) I7 k2 Z. O}
% i& n4 U/ j; D, b# ?document.write('</td></table>')1 a5 D: W: Z, c; _9 q0 V5 t0 M/ ]
}
- y0 ~5 t7 r) G9 Q/ M# b4 b}2 H) J# K2 Q9 V! b
</script>

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