返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ }$ b+ ?3 |! B! T5 s) p
var marqueewidth=3006 i+ Z+ m( p6 m: P7 b2 E8 ~; a2 P
//高度
3 l% T3 Y' F% W9 I# o5 L9 Mvar marqueeheight=25, f3 C! t0 \% s: S1 O5 O* {* M
//速度(1-10)2 ^( V, T/ J7 q6 \* {% z- M1 J! ~' X
var marqueespeed=35 F! }5 c' v2 a! H% x, a
//背景颜色
% c- b2 ]7 |: G2 Rvar marqueebgcolor="#FFFFFF"
0 D- p  q/ k0 E4 W: e1 J//是否能暂停 (0=no. 1=yes)?& M# L) `6 G! N2 Y2 H9 M
var pauseit=1  v. _& x) r* ~& G+ u
: I" ^/ K: F( [- a; R& r, ]
//修改显示内容1 w5 a) J) T4 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# [6 i/ `2 d2 ^: e3 _2 k2 N% E$ w0 S, g8 Y
+ R6 x; E5 ]1 q4 u5 f( @
////下面不需改变////////////
, o. L0 r1 F7 ^) P4 h2 m
5 i8 ]+ _$ p+ o) Y9 x) @3 V% mvar copyspeed=marqueespeed, J- D' l* j  {1 \
var pausespeed=(pauseit==0)? copyspeed: 00 [5 e8 W$ D/ a
var iedom=document.all||document.getElementById( G, ]) I7 Y6 p$ t+ B
if (iedom)
# p) M& ~" [  R* h9 y1 @+ ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), m' Z6 F% Y; C+ ~, A8 J
var actualwidth=''0 W& P1 y, y# O% h9 S- v! `1 u1 Z
var cross_marquee, ns_marquee
& C' o$ ^- l; O6 m& K% d
- |* G" O8 A, v7 @/ |7 p2 Xfunction populate(){
6 Q( t4 w# @2 e, G# ^5 lif (iedom){- _, R- o8 k$ r0 w" p
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, V% w( P& ~& M' z; p
cross_marquee.style.left=marqueewidth+8
; B, q0 N8 `5 t, v8 `8 ]6 Ncross_marquee.innerHTML=marqueecontent# Q" d- z$ j8 {7 _/ C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- ?% Z0 S7 t/ O5 I4 m}& @$ e- q( P- ]: p. k
else if (document.layers){
4 ~; K5 g! D  U( c. ~4 ?/ Uns_marquee=document.ns_marquee.document.ns_marquee20 I: C5 v7 H6 O) J* E
ns_marquee.left=marqueewidth+8: n  ^' U; [0 F0 L8 Z5 U, Z! ~. k
ns_marquee.document.write(marqueecontent)
3 z, O9 o3 [# Fns_marquee.document.close()1 P% M; q4 r% A9 Y3 _+ t
actualwidth=ns_marquee.document.width4 j* B' @$ o8 ~* h$ S0 m3 D9 R
}
& q8 ~4 Q! k- Z6 g) O1 a, ]lefttime=setInterval("scrollmarquee()",20)- M4 ?6 M# e' U  b. I
}
% A! w% r+ H0 n9 ]2 }. K2 j. kwindow.onload=populate
0 [# }0 ^' S7 r
/ m8 u' J4 G- ^: hfunction scrollmarquee(){+ R) \- O" H" q
if (iedom){
# S" W, g* o9 F' \4 A1 j* E: sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ o# S% K; X, t  J% k+ P( k: [  bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: Z( P( ^6 i$ T& n% W% r4 Oelse
7 @0 a& `! z9 Qcross_marquee.style.left=marqueewidth+84 d! F9 ]1 Y' u+ F1 x0 ~& ]

4 O- s6 e" q' n# D. }}! t" T5 J1 F$ J+ f" c# {% t: k* v
else if (document.layers){
  d: H* B0 g& x0 b1 s% r) W" E8 M/ sif (ns_marquee.left>(actualwidth*(-1)+8))
# k& k7 j5 G' uns_marquee.left-=copyspeed
' V+ e/ a4 J3 M- G# |3 Z2 T: r- welse9 b% I8 `; R( u1 u* Y, l- v
ns_marquee.left=marqueewidth+8
" s; g0 w' p4 N: E- r}
' M: H0 _9 t. }, u* P. \# D$ A' x0 L2 `}
3 `2 ?5 _! ~1 j. D8 L9 m* B5 w  y
# S; e0 t2 G1 W2 l$ M, ]- eif (iedom||document.layers){5 _* M1 b- O4 y( [5 X0 F+ P
with (document){
' {. g, o2 g% odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* X0 i+ `  d" h7 ^; {& H- D; `
if (iedom){# b* t; C( ^  [' f+ ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( R' R# R3 Z. N6 N  \+ G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 g. ^! n. v4 W* s; Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 S+ h: ?2 ^  M% v  A& u$ ?5 owrite('</div>')
9 q: u2 O! V) o$ ]/ `}* N5 o* E+ P0 J/ C% f
else if (document.layers){
3 t- w5 N% z# H! T4 B. E6 \4 r7 W/ bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, U  V# X3 ~3 |0 pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 f! z8 c* W: C6 k; b' u
write('</ilayer>')
' \& b% s$ x$ @- _: X* T* D}" r' F/ b( }( G- a2 @. O
document.write('</td></table>')" w/ B4 P" q5 V+ q3 d: X+ K
}
/ G" b% n+ U$ l}
) Z$ I2 {; r, y$ N7 o1 @2 P</script>

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