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

|
网页之跑马灯文字特效
//修改宽度/ @/ Y4 G; s% s: N' L3 g9 a
var marqueewidth=300& B9 o" Q& ^3 \3 E; R# T) G
//高度 v1 s- G+ ]* B/ c& O3 \! _
var marqueeheight=25( [8 `8 n* N: [$ r" p# e3 ]5 ^) c R' p
//速度(1-10)# N) N1 `: N" r/ q1 F6 ~6 X5 T9 d
var marqueespeed=3; k+ r% K% f, x( g6 k, c
//背景颜色+ g7 G- i% \1 f0 x6 ]
var marqueebgcolor="#FFFFFF"2 g6 g/ o' {) U( B' D' \
//是否能暂停 (0=no. 1=yes)?
3 R$ Y: D% L. M4 ^3 B; R% v& [( Z# |var pauseit=10 c/ ]9 Z: {; }
$ `" {/ J" n4 L) a5 t7 e
//修改显示内容3 N3 x+ @* \' i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& C9 R* f N7 N! s! C3 E
" ^; i% A4 D1 v. m& l" \' T1 X) C8 E) x- }( n1 M: ?
////下面不需改变////////////
+ J+ |9 M) {! Y# ?+ f% A5 z* @) D' q1 Y9 C$ R# N2 a/ X4 Q
var copyspeed=marqueespeed
* J- A- r0 ?8 _' K) \$ c. Dvar pausespeed=(pauseit==0)? copyspeed: 0
y% D, a/ E; ~* E( qvar iedom=document.all||document.getElementById
" L7 C% {5 o8 ~if (iedom)7 m" U9 K6 K. ?# f9 G" p7 Z# ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): G! O6 @) g; d+ X3 Z
var actualwidth=''; Q8 K3 V; k2 ~
var cross_marquee, ns_marquee
) W9 ^! Y2 b) m& p1 ~/ F& j2 @1 e7 L8 @- Q# W+ x" |7 r3 H
function populate(){
9 f: i7 M0 F6 |' C7 t1 cif (iedom){ i$ ]+ ^) y1 n2 i! a2 U3 x! s( F& _3 I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 Y7 V/ Q+ E3 w& z! R% g9 bcross_marquee.style.left=marqueewidth+83 Z/ f2 n/ O; B$ M. a$ { n" E+ r
cross_marquee.innerHTML=marqueecontent3 j9 U; h5 i5 l% I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 l' x0 F6 I h( P3 n. Q4 s& v, W
}* `% T2 p& l4 K" {
else if (document.layers){
* q! p# X2 w9 Z6 b9 t1 g3 H8 q+ Jns_marquee=document.ns_marquee.document.ns_marquee2
) Z* S1 r x8 f# ]" Nns_marquee.left=marqueewidth+8
6 ]4 F( o4 ^: \. xns_marquee.document.write(marqueecontent)
0 k n8 a5 h+ d4 s, ens_marquee.document.close() H- R M0 @& l/ o
actualwidth=ns_marquee.document.width
6 A0 c; V# e( E8 X+ ^}) C N# `0 v" F6 h a/ W$ j! s
lefttime=setInterval("scrollmarquee()",20)
4 f6 ]0 ^* n1 i# }4 m, j7 I}
5 s7 L- Z: u$ K* awindow.onload=populate* J& O/ c* ?3 ^. Q* n. c
. X" `' n x: A' ?. Y( _function scrollmarquee(){
0 Y9 D! ]9 h! jif (iedom){8 [; e) K/ }7 K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- p$ _0 q) J1 i: T& zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ w' Q) `1 z5 p4 M* \
else, j' ], q; a6 h: r6 }6 ]/ f& j6 Y
cross_marquee.style.left=marqueewidth+84 G' c) ^$ J D. h8 q
+ T c1 w% U6 r$ q& L
}
\# z) A- x% Y- eelse if (document.layers){
: q9 `+ s4 a0 T1 {8 Cif (ns_marquee.left>(actualwidth*(-1)+8))
3 `5 i; H- V+ q, O' }; ~ns_marquee.left-=copyspeed
# e- P0 c. ^4 I8 \ Jelse
0 Z2 }( Y% r# r) Q- |7 g- S. U$ {ns_marquee.left=marqueewidth+8$ [5 v3 |% `8 h+ ]* {$ d- x. t
}1 y4 C; o/ ?( J4 {0 s. ?( A, W
}
7 n% O- u) p4 B/ h' ~6 h a* f" Y6 p3 B e
if (iedom||document.layers){" q/ x* G X% x; q- H
with (document){4 S8 \* N) V* e( q z; q9 J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 [, `, h; S( f4 c6 U0 Rif (iedom){7 Z3 N1 K$ j( s/ Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( Y- s ]( f) ~4 E. |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" y5 u; n. a0 S8 Y% [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# c: \1 C5 Q1 \5 t5 ^
write('</div>')/ D$ p. q0 {7 r# f+ w
}
0 o' ~* N+ e( e# k2 w7 jelse if (document.layers){, D1 h/ i. Q( @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), L4 B* y1 A1 D3 D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 p7 Y: Z& V" s6 m
write('</ilayer>')
. a/ J* t; |' g$ X1 J: q d2 P}2 S M0 d2 C' |
document.write('</td></table>')! t4 {9 R( |5 s/ d6 `
}1 r; y% P. b' \
}
6 n4 V1 b; }+ u8 ~1 i</script> |
|