返回列表 发帖

网页之跑马灯文字特效

//修改宽度: d* H3 b, L4 i6 V  W/ @: R
var marqueewidth=300
: H  |9 Z1 m3 z( ]: m; B//高度
) @' \7 |2 k3 j' t, V1 Lvar marqueeheight=25' G7 z0 T0 P& p# R: n
//速度(1-10)7 p0 g# \5 `# f0 y, W. b
var marqueespeed=3
, j3 z" \3 k. Z+ U" g, \: ]# V//背景颜色0 G7 z' v8 _# `) T  _  u3 O- }* a
var marqueebgcolor="#FFFFFF"
6 Y; I/ e' G$ R1 p4 b//是否能暂停 (0=no. 1=yes)?
; K( Q# n3 w, F6 k- H9 Q* j7 _' jvar pauseit=1
  \, E9 Q5 v9 A1 Q- s7 B$ Z' _' U7 r
//修改显示内容
/ k( Z) ~' x# V; K3 E& p2 cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 r0 l9 J  a  ?0 I+ n8 M1 b

& h% a6 L5 b/ h' x. q1 ?- G5 G# F! i: t$ W
////下面不需改变////////////
2 @! e& Z& v& X* D5 S4 W3 ~. i- c) m* A4 d4 R8 q( e
var copyspeed=marqueespeed
$ D+ A, U+ q7 a$ z% t. Qvar pausespeed=(pauseit==0)? copyspeed: 06 K; V( d' e7 g4 H. s. v
var iedom=document.all||document.getElementById6 a# l" k* H5 ^$ I' e+ j
if (iedom)% q3 U: r: e* E7 K$ `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ G. `9 \8 B( h% E: I1 s. Z
var actualwidth=''; i3 R8 h6 N3 E; b- \
var cross_marquee, ns_marquee! l' ^" j. {! _. b- e
( G  p, c5 I: j5 V+ i
function populate(){
$ A8 h( l  S2 `+ Q3 ^! T) _: Eif (iedom){
& Q) \1 q. J; ?3 B9 p4 lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ L* j$ q3 ?# X+ Icross_marquee.style.left=marqueewidth+8
( c8 ]. b$ Y# C0 ~. y  V  k) |cross_marquee.innerHTML=marqueecontent
! b* t: R/ [+ C. @* O7 Q/ W7 p! Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ ?# E' s6 q& S4 x: x* Y}1 @9 M: s: S) K/ g3 M+ `$ @: S; h
else if (document.layers){# d$ R% S) \, P
ns_marquee=document.ns_marquee.document.ns_marquee2
; _- N$ E6 `* d8 q8 b6 Rns_marquee.left=marqueewidth+8
9 }3 Y: ^" ?0 @& T, p/ H7 zns_marquee.document.write(marqueecontent)
& m( l! e# P! zns_marquee.document.close()
3 @3 G7 ~, D8 A: [/ S) C. V8 Dactualwidth=ns_marquee.document.width4 W! I" z# h2 b1 Y9 H- d% y
}( f% }. y* ^8 l7 K5 e0 g
lefttime=setInterval("scrollmarquee()",20); v( r( T  X/ n0 p! u/ q
}1 G: G9 e" G/ r$ c2 ?# x: V
window.onload=populate  Y5 Q$ ~' r9 f: W
: t' R& D' q+ r
function scrollmarquee(){) C, h* E! C7 `
if (iedom){8 c+ M: C$ |, D; t2 t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 V! }- ^- I9 h( u7 a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 v& P2 e0 j; C2 h7 q, Pelse
/ s4 j: y' L5 |; ]( N) i% Vcross_marquee.style.left=marqueewidth+8) x% q4 n' k3 T
1 c7 L& H$ J# k" ]
}  J# m& K# y% M3 N" {8 g0 {
else if (document.layers){4 s1 K  Q5 C1 a" V4 F% \( m
if (ns_marquee.left>(actualwidth*(-1)+8))
. Q$ z1 \6 P. O  d3 u& Ans_marquee.left-=copyspeed
. X% M% K% p8 helse
; D: }8 o3 P9 R7 O4 t1 fns_marquee.left=marqueewidth+8
3 a" p. H# R2 ]5 w- a" t: m: C}% C; Q( D5 D3 R3 |+ [% O/ r8 e
}9 E8 v  J3 z9 j, r3 A
6 E: V% ^  d2 A; Q4 i5 [, A$ [
if (iedom||document.layers){7 w2 }$ y1 j; _. w6 O; \3 a
with (document){2 Q2 D( b& i! \5 Q4 T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 T) p% {: A  b* Y; n7 Uif (iedom){
& W5 b$ q4 h: u( ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 h! Q$ G' _' E8 m7 y) u+ e+ w# ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, q1 g7 @9 Y* r9 p3 R* F! U0 Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ P. _8 E! K6 m* {  ~/ ]" E& [
write('</div>'): m/ d" j2 {5 T, e
}8 \/ [* o2 @: f8 i; Q0 P4 p' _
else if (document.layers){% {5 @+ C& U% `2 K2 g( F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); }- a# x/ p; `# D: C! g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! o( Z" O" b2 swrite('</ilayer>')
- r4 f$ _# o1 r4 A$ C. T7 u}( B. |% K2 E7 a1 r1 v9 z4 O/ q, o
document.write('</td></table>')% D6 ?+ c) {- |- ~' s0 `0 h
}- O# z" i! p, }) E( k
}8 T# V& _! A" V& ~2 F, D
</script>

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