返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( d0 P# H' e8 O) z! mvar marqueewidth=300+ l) I9 f; a; R5 A, o5 M0 x
//高度, _7 E% u. N' n. D
var marqueeheight=25
8 ]8 h( q% }2 ~9 j7 ~0 ]//速度(1-10)
( d1 e/ {1 y8 cvar marqueespeed=3) }1 \* T! k/ J8 Y
//背景颜色; M# O/ B0 l7 U
var marqueebgcolor="#FFFFFF"
/ i8 l" d" n7 i6 x( c5 h//是否能暂停 (0=no. 1=yes)?
! h) l  \8 Y; H" Cvar pauseit=1
# j+ Z( o+ ]: `" f3 S
, _  f( _0 `6 k' c//修改显示内容
8 ~  T4 N! X% t8 W; W! w4 C, i7 Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- S) u2 h" F8 h. Q* x: O+ c5 ~% Y6 \8 H* H6 e2 ?/ ]- e8 {
( F1 `; ~/ O$ u$ F  `3 C
////下面不需改变////////////: s1 N6 ~" g4 T5 l* u, T
1 Z2 B& B: F! H! ~8 E# p: X
var copyspeed=marqueespeed
3 K) @! }, e* N* u+ kvar pausespeed=(pauseit==0)? copyspeed: 06 Z& R/ h6 k: W7 z, W
var iedom=document.all||document.getElementById5 I- P: k) `1 O( g4 x9 K7 B
if (iedom)" N. V$ `) a% k& S; ~' a- k; L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- S7 ?% \  {: C( E: U: Q1 h8 X
var actualwidth=''7 B  G* a$ e% d
var cross_marquee, ns_marquee
, D! Y" g, v* {% E6 I  V: q" g0 V
0 g$ }. P- J  }( I7 D0 `2 ?function populate(){& n! h. |9 H& T2 h4 K3 V
if (iedom){
$ C' x8 i8 S, s4 ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' A9 p2 p% L! Fcross_marquee.style.left=marqueewidth+83 D: z4 r) ]0 p2 L$ a
cross_marquee.innerHTML=marqueecontent
& T& ~* U' ]5 uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ ^4 a6 f* P- ~7 s3 S
}
% o: O( T/ K) F$ [: O4 y2 Qelse if (document.layers){
' `2 x, W% G% v! rns_marquee=document.ns_marquee.document.ns_marquee2
! b0 Z  _" c6 {# Ens_marquee.left=marqueewidth+83 A/ u9 A5 X9 T) ]. I6 P( X
ns_marquee.document.write(marqueecontent)
: E( x+ y# J, Q. s# O3 A. ?ns_marquee.document.close()
/ z4 W( _; e7 Uactualwidth=ns_marquee.document.width( i. e8 k9 x8 q- d3 h
}
& y" |" D1 J- ~: N) @. |lefttime=setInterval("scrollmarquee()",20)
( {. M, A8 f% v9 p9 `1 Q}, [8 z! W0 T! |( _& X
window.onload=populate
* F/ v$ C" I* e! W3 j
& U& \0 ^9 P3 a2 Z$ ffunction scrollmarquee(){, Q1 \  B2 `9 N
if (iedom){/ ^: e- k- P2 n( ?5 h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): ?& O- Q# V' p2 M, B% S8 z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) D6 W( g( @+ n- l6 N8 T" C
else
% y1 V9 ?& i2 R1 o( W, }$ gcross_marquee.style.left=marqueewidth+8
3 I: A& i8 b! j# ~4 ~' i+ V
% u8 V4 z8 c9 W5 Y( K* v}8 V  G& U, y9 ^$ \/ @% v( Z
else if (document.layers){
2 t' q* o! C' Dif (ns_marquee.left>(actualwidth*(-1)+8))9 F: {! a" c) r9 |- X. U$ x
ns_marquee.left-=copyspeed
( O/ z  T; o1 A+ d4 V4 Kelse
% r7 B6 m' ]8 h* N6 o! wns_marquee.left=marqueewidth+8
$ b# a: T% v  u0 J! m$ H# R5 t}) [4 U# O& k& _! n  ~5 T
}9 g) V* S! K5 T
3 n; s- S) l8 n  e3 T
if (iedom||document.layers){
; T- U( M! A5 V4 K: Ywith (document){: C( \0 F! u* K5 P+ D0 {, t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 h$ m& N: r& [+ l5 Rif (iedom){
$ ?! j% }* X, @0 `, gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 ^6 e  F' {! L2 O9 N9 s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 B' r# l! b  z2 V. y! P1 `3 A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 b8 s8 B. q0 g  ]: m8 G+ M7 @
write('</div>')6 x8 P2 o9 ?, {) H
}
! Q* q$ K8 m- E8 B# n4 b7 melse if (document.layers){
3 d7 y- V/ _0 M% c0 z" W+ D; W' {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" _9 L+ c: u* d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( [) Q, C1 A* B# Q1 }$ ]
write('</ilayer>')5 S! H- e# _# N$ g6 @
}
* D1 u& J0 a0 p2 }/ ]$ K; ?document.write('</td></table>')
. `' W, O7 r* ]- U# K+ j, ~: O5 z8 f}2 r0 S) Q7 J1 P* q: J- b" i1 C
}5 f2 q3 \9 c* w" D6 J! L  w, L
</script>

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