返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 \9 M2 B$ x- B" V9 c  Ovar marqueewidth=300# h! D4 v3 l0 m2 u0 e: T& c
//高度
2 q) K/ I3 w2 q' m) V7 w3 H9 Cvar marqueeheight=257 n% z2 O* S- j  |0 Y
//速度(1-10)
5 o; F1 D$ O( U/ B$ k  m0 Xvar marqueespeed=3- B' u( f3 U- o" w
//背景颜色
2 C& w0 R) p9 H6 ?7 d5 h& D* cvar marqueebgcolor="#FFFFFF"
* k% H" @% m) Y3 |//是否能暂停 (0=no. 1=yes)?
2 I2 x: r5 h1 F+ [" A6 fvar pauseit=1
8 n* i4 S; Y; q8 V1 c& b" P
% x" ^! c( [0 O9 a//修改显示内容1 X7 S# n" m5 e3 Y# J$ J8 ]; k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 n4 `' {  w4 }8 a/ A4 z) y% R2 g+ k" n

0 l" [" P1 X6 g7 ?$ h
' N+ O6 e5 }1 f; v' B. m4 z////下面不需改变////////////
2 I/ u$ g. L6 G9 h+ f+ c: y2 N& n1 V
9 w, _  T1 w$ u6 b  ivar copyspeed=marqueespeed
, j3 O! B" E) Q- c; V5 C: p2 tvar pausespeed=(pauseit==0)? copyspeed: 06 g8 {# G  V7 _7 Y9 W- \* Z; Z
var iedom=document.all||document.getElementById. l4 d- N; ~) k9 @! e- h! Y4 n
if (iedom)
. C5 t! x4 S. N1 `2 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# q0 a. c" a% _8 L+ a) Vvar actualwidth=''
1 x9 Q3 k9 }! j1 T% u9 Q- N" Vvar cross_marquee, ns_marquee
; }6 I0 G6 X# O" D  ~1 I/ o9 d
8 u0 p% ^- f+ `, |) w" f9 Vfunction populate(){
/ I) K2 N3 C- w7 v6 F3 Kif (iedom){
5 E7 {. m7 n! v' F) @' y1 V# hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ k0 a: m# H3 c- s& m- {; O9 b
cross_marquee.style.left=marqueewidth+8
5 a* ~9 C! l$ l8 Z& t5 L+ K- Y. @* I2 wcross_marquee.innerHTML=marqueecontent8 _8 v7 `0 y1 }8 Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 a" _3 M4 O" w( {% W/ U, ?}
$ D5 E/ |2 q6 E1 helse if (document.layers){
5 ~8 c7 f: c6 n7 a8 |% [8 D( B  qns_marquee=document.ns_marquee.document.ns_marquee2
0 d8 u5 D# P. P: o2 ans_marquee.left=marqueewidth+80 D# d5 n- T5 L  q$ F6 m
ns_marquee.document.write(marqueecontent): q0 S0 F; }$ A. [
ns_marquee.document.close()
7 G) g( V; a5 Z9 zactualwidth=ns_marquee.document.width& S6 E# ^2 ]- x/ n. o/ l7 t3 O3 U
}
" z, e5 a$ Y$ P8 b7 vlefttime=setInterval("scrollmarquee()",20)$ k" y, z/ Z9 U+ \; c  y
}
6 A& C/ p/ @/ x+ ~+ C# L3 N! lwindow.onload=populate
2 u* W7 m8 l8 Y9 c+ J; y) Z8 a- z% \
2 \3 n- h( H  m4 ^" O2 [1 m9 Cfunction scrollmarquee(){
: C, I* |4 p) I2 c# C" ?' xif (iedom){# B1 J( i7 V4 Z& Q5 h; W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" Y$ C9 ~' [# L6 G8 c( R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ F" C- `! C7 j2 N- A3 X
else
, I5 F. f: x6 p+ l- R8 C2 H4 ocross_marquee.style.left=marqueewidth+8$ F2 ?7 [: Q( ~' p

5 a9 \" M! p" H& K. B}
+ Y) N' L+ Q( u: a; }/ G. P, pelse if (document.layers){5 T9 j4 P  Y' w6 W) R0 K$ C% e6 a
if (ns_marquee.left>(actualwidth*(-1)+8))
, {: E0 N# ~" G( W) K8 K0 N$ ~ns_marquee.left-=copyspeed
& X6 z- v2 _; s4 h  F/ Celse" M7 d% w$ J+ n9 ~, k
ns_marquee.left=marqueewidth+8
7 }  u( M; a2 i* o: p/ `  w% N: A}
4 z4 S9 A. G3 Y7 C5 Y}* U3 ?/ I; l& d& p/ P2 m% e  I
9 R& G+ f( {1 f% [: }& Z, S
if (iedom||document.layers){
3 ?0 W- s; W+ {with (document){# c( [, E+ n7 U4 J$ e$ t7 F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( m0 X2 a5 Z; K: H
if (iedom){
: \; N  g: X8 F# @* D3 V  X6 @/ A( T, Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 y$ n- Z8 ?' \+ I9 xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' G. O1 S# `: u- M4 A) U! bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; j" U6 k1 E6 dwrite('</div>')3 H) H/ S0 Q9 Q, P8 y
}. k# X3 g# Q% ?' \
else if (document.layers){/ N- E+ S" m! v# D3 l  G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ \% L6 _% j8 v; Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( K* a; g) L  g# _) F  Z
write('</ilayer>')
) ^" e( j: |/ M}
- g# b9 F, {3 Q, U0 v. `3 M0 bdocument.write('</td></table>')' g/ p, l7 e: }" o
}/ Q; y. e, ^; g: ~
}
0 q; V/ E, D8 ~. f</script>

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