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

|
网页之跑马灯文字特效
//修改宽度
# ~5 T f8 k" U* S4 o: v+ h* vvar marqueewidth=300
: ?1 ?- G* f/ F* ]7 x& N5 W8 {//高度' }0 o9 ~( B6 e% Y) B# |" U
var marqueeheight=25
( d. ^9 \! Z. ?+ @) ]" V+ O//速度(1-10)
: T3 Z `( `% i8 F6 zvar marqueespeed=32 x1 f) ^) z# V7 r9 H6 e2 e. ^
//背景颜色
9 L& w& w' ~8 G% s+ Svar marqueebgcolor="#FFFFFF"2 D; Z# B9 U. p0 U% v8 A
//是否能暂停 (0=no. 1=yes)?
6 O! G. e \) K, R* H& Ivar pauseit=1
+ p$ M0 l! p" J( f- q8 f
& d8 F; Z3 E* f; z3 F$ D6 G//修改显示内容
$ I6 X/ U! D _- q% v* Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 _' S6 O3 v" g7 F0 s9 J3 z: Q' Q( J) F2 H
" l" f9 I) t9 [' o; ^- |+ f////下面不需改变////////////
1 R j2 h/ u, q! I' O" M2 p+ j6 }; F+ r! @
var copyspeed=marqueespeed3 V0 P4 ]$ {! i% w
var pausespeed=(pauseit==0)? copyspeed: 0
& L; E0 L! e9 n5 B1 s" Dvar iedom=document.all||document.getElementById
8 r5 m/ k+ v O" K5 mif (iedom)
: J. r( X0 L/ V' b& fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); R8 A0 j4 I: B& ] h6 M
var actualwidth=''
$ Z- L" ~' d: ^ bvar cross_marquee, ns_marquee; i- z4 ~8 Y2 S+ \" K9 W6 \
0 |! h' D0 M! i; m# dfunction populate(){4 [ M9 Z( Y* T# y$ B! M, B6 Q
if (iedom){+ l- _7 ]$ i# O' F% ~- H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) p& R3 _: V5 F2 t% `, @/ Vcross_marquee.style.left=marqueewidth+8
" X+ G U3 Y& |cross_marquee.innerHTML=marqueecontent5 j$ |, S: Y6 e, s; \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 `. ?$ J( V$ Z6 B! ]' |
}
% `5 M, m5 l6 ]+ @+ ~4 w9 ]# r- `else if (document.layers){
. [! [% K) g) o2 N+ o- ~ns_marquee=document.ns_marquee.document.ns_marquee22 Z5 E5 S0 r U* Z5 y: J
ns_marquee.left=marqueewidth+8
: r9 ^1 l" X" @) M6 ?. `: @ns_marquee.document.write(marqueecontent)0 g& ?1 r+ p5 L5 D, J& ^
ns_marquee.document.close()
6 T; z6 w3 p9 g2 C% @actualwidth=ns_marquee.document.width
- y& n) K" U% x3 S0 S( v$ F0 w4 {3 w6 [}) b2 t& z# \% V8 ?8 X0 c0 V
lefttime=setInterval("scrollmarquee()",20)
' d! O7 ?7 x" m! ?0 R}8 f1 G; u3 @& y& v4 j: S
window.onload=populate
5 a6 [8 ]( v) [
: E, p7 ?+ a) ~$ u) yfunction scrollmarquee(){
5 @1 o. ^+ T" M0 \ Q8 y7 Bif (iedom){
% u1 O7 d, b2 Z9 f* h Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 I, B2 \5 f* t+ m: Y4 f' h6 ~; I$ l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
b3 p- O' ^/ t7 lelse7 ^! G% c! D8 f: u" z$ k. X
cross_marquee.style.left=marqueewidth+8
( _# M6 Y5 r1 e1 c. |
& N2 }2 w$ ?: d. U1 W4 G) w}$ A& R4 F, R. ?. ?; r
else if (document.layers){
5 v/ f* r5 m, V/ X3 lif (ns_marquee.left>(actualwidth*(-1)+8))& ^( F$ m v0 N+ N/ u" x; Y
ns_marquee.left-=copyspeed0 S4 ?' z: M0 }3 i
else
" r% x- _- m |: Y% R6 sns_marquee.left=marqueewidth+8+ ?1 \, l( t& v( |
}
0 }* ^* G; K6 Y G}
1 Q. s, q6 D' {$ d2 m# X& o* e. T' g0 m& u3 ^( E
if (iedom||document.layers){+ @# J2 S) V H' ^1 P9 T* J. s
with (document){7 o, D. h% d! |8 i7 r' I0 T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 j' q: n" A) U% P/ }8 ]& b: [
if (iedom){
0 D0 y1 f3 |& t/ O" A b9 |9 p9 Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 j' Z8 P I5 r7 W7 A
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% U8 K: Y% }' V4 e+ e" m, j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ |/ Z) K2 F+ C" a+ h, gwrite('</div>')" N/ y; c: ]: P. g+ Q
}
" o5 q. i: p p9 m# Aelse if (document.layers){3 A3 [3 Y3 r0 z2 N: {& W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 d4 ]6 z+ \5 a" ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); s- j5 f" v% M- ~
write('</ilayer>')2 w& h0 O9 N% x d
}
! B( I3 Z- n( S0 D+ M3 R: ydocument.write('</td></table>')" r' e4 a6 Q; S4 b
}
) j! O& l! Z. `8 A% X6 h}
' m; l; u' ^: V9 B</script> |
|