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

|
网页之跑马灯文字特效
//修改宽度
# N& N! G5 j( G1 `var marqueewidth=300
3 ^: c# m; Z' m( C/ |//高度
- n) Q/ e, C: Rvar marqueeheight=25: ^6 d8 s, l/ x1 Q' C- l x
//速度(1-10)
( Y$ f" `; @7 b9 H2 tvar marqueespeed=3 L# S- c* `8 @+ ?: K. `; x: I
//背景颜色. R+ U( L1 _: W4 M
var marqueebgcolor="#FFFFFF"
3 E4 P3 ~7 D; _7 y& U9 n' _5 ?& i//是否能暂停 (0=no. 1=yes)?
: d* g% t1 e. p! Z& v6 Jvar pauseit=1
2 }; p1 x; t5 |0 Q, n5 u. S: U! o
- A- G. {; A! x2 w//修改显示内容1 I! H0 Y/ v' r+ g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( w( l3 i2 n4 M& i- j* k# E
- y) j! i7 V/ E% a
9 k9 @4 i/ y* V5 M% R8 S& C4 A6 _5 O////下面不需改变////////////, O& V/ Q7 o, B
' r y3 _! _) u
var copyspeed=marqueespeed
9 B$ E: \1 P7 Y( z3 J/ }1 P$ wvar pausespeed=(pauseit==0)? copyspeed: 0
0 @$ U' n6 a0 ~8 gvar iedom=document.all||document.getElementById
" E% ~1 a- h# v- Iif (iedom)3 `9 C2 |+ ]4 k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' X1 ]# f" ]9 m' N3 G7 J
var actualwidth=''
% p" h7 @: z. v0 ~% y9 u- cvar cross_marquee, ns_marquee3 ?. ^4 ^0 v1 W$ e
$ N$ i \: s2 ]5 V2 Vfunction populate(){* S$ s2 \4 i$ j3 Z) N Z
if (iedom){
, w( [, m# H7 @; N( gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 E4 W x" O! {cross_marquee.style.left=marqueewidth+8
9 K/ J e5 q4 _5 M/ H$ A3 Ccross_marquee.innerHTML=marqueecontent
4 A/ @- {7 k5 k4 \1 q% D2 x) Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 q: h: O" C# i) i. t# f# i}
2 A" \0 a4 {4 K: Z7 telse if (document.layers){
2 Z! k f! A' V$ `: W3 E6 ^2 A# Zns_marquee=document.ns_marquee.document.ns_marquee2
- y# i8 L( R# b. hns_marquee.left=marqueewidth+8
7 O' h4 i+ a& |/ E9 i& c: Fns_marquee.document.write(marqueecontent): Z: o: g c- m0 z
ns_marquee.document.close()# A5 e# r- k8 m: E- M
actualwidth=ns_marquee.document.width5 h0 R Q) [" T: p8 Q) L3 u
}6 P/ y2 i4 e% a' d
lefttime=setInterval("scrollmarquee()",20)( a; E& V2 F' U5 S& C4 a( ~
}
& J5 J; O. r) L9 R' K( Kwindow.onload=populate
. a" q' v- d' J+ o N8 V# U1 l* U0 i8 i: _) Q
function scrollmarquee(){% v6 o1 j* b/ M* R/ A" n
if (iedom){
! X" [9 @. _, B( f4 {. z, _/ a* P! Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* s, H' c" r6 Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; s9 \: e( s! @" l
else8 F% }! D' D! ]0 L& h! ]( t
cross_marquee.style.left=marqueewidth+8, X0 p6 F$ L+ ^# P6 v; ^7 ?
" L, {$ @, D: P}2 { B' o5 m0 B
else if (document.layers){7 z! x1 J E! [. n( F2 X* u
if (ns_marquee.left>(actualwidth*(-1)+8))
5 C4 U0 X+ D* k. X. W# Z8 F2 Dns_marquee.left-=copyspeed
7 |' C- @( z+ n+ xelse
7 Q3 S( W5 i$ o6 ons_marquee.left=marqueewidth+8- ~! a. e6 l+ }* c b
}1 d) z2 v- I; _% r" Y" b
}
0 z! V* @; z4 ]3 O; {) |* p0 t u. Y. E3 g4 M+ R
if (iedom||document.layers){ I* @5 `6 Y, w, e- m4 {
with (document){& k8 w6 q3 ~2 d8 C& @$ ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ T$ U. I4 i' \: T5 \, uif (iedom){4 G& {- } ?. x2 l7 k1 W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 [1 H% h. @# w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 n+ t% S4 z- C! D, |4 dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 I" A& R; G7 Uwrite('</div>')
& @- y+ X6 z% r- F}1 T: E3 Q4 r9 i+ h& e
else if (document.layers){
5 y6 Z0 R5 g% @$ Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( g7 l. D: }+ A. \; j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- t6 g4 N8 O, h0 C! J, V! Kwrite('</ilayer>')
, I! {: c4 ^# J0 G6 S}1 _+ k$ w. {/ p! O
document.write('</td></table>')5 s1 i4 V, |$ a; m& i
}6 K0 Y# o- C' J1 {+ g( X
}8 c2 i5 A8 |7 C s8 v: E2 n2 ?" |( x
</script> |
|