|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
3 E- z7 `1 R- Uvar marqueewidth=300
: h5 O+ B% \& W6 x& a3 n//高度
! j/ V& @* |+ \* D; X3 y, u/ Svar marqueeheight=25
+ L! I, B9 q7 I, x, } m//速度(1-10)# K" K0 `5 K, S* ^+ u
var marqueespeed=3
. s- s6 q% u& S9 _8 _//背景颜色1 S+ n4 ]/ w" t! z2 R
var marqueebgcolor="#FFFFFF"
/ q: J: ]6 R- k+ M3 W& y5 l3 j* b//是否能暂停 (0=no. 1=yes)?/ H, M& s4 Z0 S2 |. H' R: f
var pauseit=15 I9 E, M2 |, x' A% j, s
' d* y4 v4 ~5 y1 \, ^7 U
//修改显示内容
/ c' c$ [1 l1 U8 `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 I `; ^, w) o2 b& A+ @8 H8 u1 Z' M" c6 L3 ` t% B
) _: I `/ E0 S0 l////下面不需改变////////////0 e9 L. v9 {* _8 }- Y
- i# C) j1 t9 }# `3 \var copyspeed=marqueespeed# E$ B" v8 i6 x" B: X T
var pausespeed=(pauseit==0)? copyspeed: 0
7 q3 C) Q N6 V& r+ M {var iedom=document.all||document.getElementById7 j+ h" n( x0 J; i6 p
if (iedom)
8 U0 R- u( }$ p" \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 ^' y x3 T# R
var actualwidth=''
3 L$ l- i$ d% u+ F# W, } Q. dvar cross_marquee, ns_marquee
# u, D! @, i8 K+ \1 {5 n1 y `0 ~) p. c7 `4 A* G/ e
function populate(){
# u) @8 K8 V* T, R9 r# Z' kif (iedom){1 u# ]$ {+ P/ w: G7 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: C3 j2 d: I+ Z: b! d6 I, `1 z: z
cross_marquee.style.left=marqueewidth+8" l8 j# i- |+ G4 o# N
cross_marquee.innerHTML=marqueecontent
6 l6 P# F% E9 N# B* K; E7 ?+ O) ^8 ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- V2 u4 d% A' k7 h# A
}' ]7 L& R, e& ^$ a
else if (document.layers){1 Y0 _" Z1 m- s
ns_marquee=document.ns_marquee.document.ns_marquee2
" r4 N( P/ U: h3 L$ ?) i7 p" [ns_marquee.left=marqueewidth+8: c4 G+ m3 v# F* O5 q
ns_marquee.document.write(marqueecontent)# F8 c: r U" V: m5 W
ns_marquee.document.close()1 e/ ~; R1 f! X2 e: { z
actualwidth=ns_marquee.document.width
( W" b) q3 {) n G8 ^3 x! h}( U- {5 E+ ?4 p+ {+ l, {
lefttime=setInterval("scrollmarquee()",20)
' k$ a; L& f9 p" ~8 t}
$ t. V1 {9 `! B* Ywindow.onload=populate7 f( l% E" w, N7 Y6 S A8 U$ z
7 J8 q- [0 r3 {: ?function scrollmarquee(){7 T2 X1 i. f7 V+ M8 L. ]# D& A
if (iedom){- z7 t8 Z3 r: G& U# X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' [* U8 i8 P6 c+ e$ X8 n% G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 q8 g9 F2 z# O
else
, l) H- G, r9 g) s3 C R% Ycross_marquee.style.left=marqueewidth+8
) q' d4 x: Q/ V
1 e# l, A# _5 A) @}( D/ s2 x( t- K6 p S& C) b
else if (document.layers){8 H+ H) p1 R$ [0 C$ K
if (ns_marquee.left>(actualwidth*(-1)+8)); u4 o- q1 o8 o
ns_marquee.left-=copyspeed- S% F2 I0 d4 u6 Z3 J
else) R1 P% [3 p( J4 p+ R) L# M
ns_marquee.left=marqueewidth+8
b- T8 J/ M, w4 @/ y}* v8 ?8 n8 ?" D; P. D, u6 H) S6 U0 i
}5 @: C( k2 z, N9 F
, N% D0 D' `7 I; U! a1 xif (iedom||document.layers){
" ~# H, P+ A$ ^" p& Q# rwith (document){
1 W* Z, l" I( e# c7 Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" L8 T" J. `# C0 R" s; q, lif (iedom){
2 A7 M4 J, ?/ v5 }4 i1 p; R- I; Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# u0 I( A( c1 ?6 j" s! @* iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, R1 p+ w/ l6 ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 G* W( `8 g( @; d) I) ^
write('</div>')4 H& r) w# {5 H+ a. W) c |# @
}
4 g3 a! Z) _& O5 q E+ X) velse if (document.layers){& R! v& W, {0 E0 b7 V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). m! H3 v# a- {# ^ G4 d9 X8 V" \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 @: U/ W9 e7 w' I: f
write('</ilayer>')5 x0 b: n7 j) F) O0 m- C$ g) |
}
& T0 r0 H2 V( V' S D7 a6 }$ Ndocument.write('</td></table>')1 M0 T: I; A( P6 d* E7 i# H: s
}
M5 K5 ]- Y; h% T}' D2 W& M: m. x" ^9 w( I; N6 Y1 X3 H
</script> |
|