返回列表 发帖

网页之跑马灯文字特效

//修改宽度% A4 w7 m% Q: j3 ~2 f( e5 T
var marqueewidth=3008 C, G+ d: T3 g4 s% l4 E
//高度0 Z9 a. r" l! J$ F
var marqueeheight=25
; B9 @# z9 n+ q! {9 h9 N8 L//速度(1-10)
9 o( f( J# M8 n- Svar marqueespeed=36 l9 }7 K0 R) ]; c( l' J+ C
//背景颜色
; n7 l2 ~, Z; f% d5 f2 W2 g3 Uvar marqueebgcolor="#FFFFFF". D, z! P- O1 k! K
//是否能暂停 (0=no. 1=yes)?
- W( M: J' E- d: T! V2 Hvar pauseit=10 B5 p0 z2 W% E

$ k& _3 T) w' S% a9 q- y//修改显示内容
: n7 }' o9 \: Z% A* Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% x/ d7 e' A+ Q$ ?0 C. j- J% R, Y, F4 B

( y* o! p, Y5 t# u7 P' _" {////下面不需改变////////////5 V# h$ S( D, O0 {6 _

2 m, R5 L  C3 S5 I9 n9 Avar copyspeed=marqueespeed- b7 A7 p! U  L! C
var pausespeed=(pauseit==0)? copyspeed: 0& i" T1 w- G0 N! u; \  m9 A0 H
var iedom=document.all||document.getElementById5 f7 {( k* b( c# b
if (iedom)
8 e* E  v/ `: A, L4 Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* i% {# ]5 n: C, g- \
var actualwidth=''- F" T( U& u* k6 D
var cross_marquee, ns_marquee
" o0 I3 m" B; I: T  K1 `2 l5 n+ M; V4 {1 S
function populate(){1 ?: r$ i/ T) G# W8 d- H
if (iedom){
  q" Z( p/ z; G4 I9 \cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. i( V: ]4 T! Y5 }% A$ ?0 }; }$ n
cross_marquee.style.left=marqueewidth+8
1 U; e; z) i  A, K% r3 @cross_marquee.innerHTML=marqueecontent- y, X) ~/ s; w- I! H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; R0 ^7 r! P( h5 m' c/ o9 I3 \}( Y7 I5 {+ ]2 y; L
else if (document.layers){5 f6 W9 m0 m) p4 y6 D9 l
ns_marquee=document.ns_marquee.document.ns_marquee2) u$ T) S1 E4 y" o9 k! u; j
ns_marquee.left=marqueewidth+8
4 j0 Q1 m. Y3 B0 Vns_marquee.document.write(marqueecontent)0 Y( l, J' m  Q! G$ H, I
ns_marquee.document.close()
- R9 |  g6 L9 |! v9 Cactualwidth=ns_marquee.document.width
/ H3 p9 ^( `2 n# n; ~/ ^; Z4 d# }' A}+ {. \' r4 e# j4 H& y- ~2 l
lefttime=setInterval("scrollmarquee()",20): C# z/ q3 @: u5 _( ]0 E: d. d
}5 a: c, i- N5 x3 _' I, b# M
window.onload=populate
& |/ B7 f$ _5 a! O9 W
9 |" @* p2 W5 K( ^! rfunction scrollmarquee(){) T" _. L# Y5 B3 H: g! Q! b
if (iedom){
& J, ~" f+ t+ }% L! N9 h7 v9 Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: B  t/ k8 f# ?+ \- |/ ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. ]1 [* a8 X1 {8 ?# X$ w/ Aelse/ F( z# y  i; G/ r, G& Y5 V
cross_marquee.style.left=marqueewidth+8# T- k7 E- g/ @% v
0 R6 K7 w3 j. V2 n- u5 N: L. E2 ?8 z
}; t- i3 v: V, y; v" R
else if (document.layers){
9 R: t* e" I8 g. g  F5 l* L( lif (ns_marquee.left>(actualwidth*(-1)+8))
) H; M1 d- ]7 v& G4 r, vns_marquee.left-=copyspeed
1 @0 Z, v* y3 F- j8 P: P3 aelse
1 j( I! ?! [. I$ k0 `ns_marquee.left=marqueewidth+8
9 Q  r: i/ X  x% w8 h" X  r}) R) e( ~! |  d0 \' Q+ @6 x1 J0 U
}# d% ~) B0 k! Z8 g& V) k

# e. Z/ _# e# w( `: G/ ]if (iedom||document.layers){- ^6 o! ?; @. B" c# h5 \
with (document){
$ L% L* t4 J3 B. rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 J) d8 {) ]5 u7 i& {" _if (iedom){
# I1 t- Y. \3 o: d; zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 P$ x) g% r5 s1 r3 I9 a: l0 Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 g6 [) c4 c! d2 G# H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ o  V1 V9 ^$ h, z; `
write('</div>')
. g) m! Z9 @! `' B3 P; d. G}
; D3 e( A- }' B" _else if (document.layers){
: M2 s. L3 a6 p5 g* L) twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 L) j3 I( d) n4 I! x6 wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  U: ~7 Z( T+ E, q7 r  x0 F
write('</ilayer>')
/ Z" ]' o4 @+ v}
( l9 u+ w4 \1 r/ C: sdocument.write('</td></table>')
& i' B/ v5 ^* p  x}
6 ?5 D: A: q8 W}: ]: c) V( l! I2 [: y
</script>

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