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

|
网页之跑马灯文字特效
//修改宽度/ L4 P' u3 ^; y7 H: e
var marqueewidth=300
- m' i: |/ @/ M1 N0 j1 P//高度
! h! Q" l0 m: X8 ]6 E$ o* gvar marqueeheight=25
; E* h% t9 W; `//速度(1-10)
& F( ^% k3 ~3 J. [9 b. x3 zvar marqueespeed=34 J! \2 [8 \* N$ v! t% _
//背景颜色
/ q/ l! i9 a* w# P" G+ T& Rvar marqueebgcolor="#FFFFFF"+ @6 F% O" R. \* P
//是否能暂停 (0=no. 1=yes)?
/ Z; y% x( S4 X2 W: T/ tvar pauseit=1
5 X+ Q! n/ _- p9 o" u) [0 {" d" X' f3 X8 G0 i. i3 x8 H5 S7 S
//修改显示内容7 c% X! R$ m' K" ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* }7 c3 V0 I% k( }
5 n# N% |3 s7 I8 e# q T# L
* _7 N3 b% R+ ?4 i6 {5 i////下面不需改变////////////- ?3 }+ g- L" C4 N' J; Q' S
. W6 } n2 J* L% c6 }5 ]1 hvar copyspeed=marqueespeed. T( N6 q- H. R# U: ]1 N3 @5 b
var pausespeed=(pauseit==0)? copyspeed: 0# g( m1 x d" A
var iedom=document.all||document.getElementById z# a3 w" n* M! d
if (iedom)4 K9 M: E& B& w2 u k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 ?- {8 ]& h! U- p0 c
var actualwidth=''
( ^$ {& V/ q/ P" ]var cross_marquee, ns_marquee
+ V0 P1 u# n$ R
* i/ N; \% T3 p, F& ufunction populate(){8 s" W D( K l
if (iedom){5 r* J3 \7 H; R, q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( M+ a( V1 H" h
cross_marquee.style.left=marqueewidth+8
4 a+ w( d" o" r4 p9 B O( z ocross_marquee.innerHTML=marqueecontent
/ T) q) }. _" L) t' ^9 a8 l3 lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 b4 z" k- c' D2 M* K( w
}
, p& g8 g& h( q4 Oelse if (document.layers){
6 @9 U- x* t9 D/ K& @; [ns_marquee=document.ns_marquee.document.ns_marquee2" H Y3 E4 h5 p5 H/ b* {5 G# v
ns_marquee.left=marqueewidth+8
/ O9 t( ]% D' g, L9 Jns_marquee.document.write(marqueecontent)0 n7 x! l6 w9 S/ w
ns_marquee.document.close()
5 T( ]( B! h- B+ W8 \actualwidth=ns_marquee.document.width
9 [0 ?, e' Y1 m9 G9 w' K}& E1 \& |# B4 G. b/ i
lefttime=setInterval("scrollmarquee()",20)
$ j$ i5 z9 q5 n7 X* P- h' h5 u+ ~}
9 X* j7 u/ V, d/ @! c$ u( Zwindow.onload=populate
& x Q- n# k) I: }/ B# I3 ]" [) X' y7 a" ^
function scrollmarquee(){
5 H' o. @' O; F- v1 W- H' ?if (iedom){
7 o+ a" \& @* j7 T Q; ^8 Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! Z/ y& W, n! e% h5 O- N( z, O8 G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 B& g0 I5 I; q
else+ P: P6 O8 d9 g0 \/ x( A' x
cross_marquee.style.left=marqueewidth+8
9 z! }/ F; o9 Q' A
0 S2 r/ [9 E, V; J. {- W1 M$ W}
) B. o* b5 q) k& I4 G+ F8 jelse if (document.layers){
% F* i9 {( c9 T! t" {) k! dif (ns_marquee.left>(actualwidth*(-1)+8))1 L8 b$ m P4 W x9 O8 \# {
ns_marquee.left-=copyspeed
4 K4 |% W7 d; o3 J# r$ Gelse
( q8 D( }$ K) T m- c6 ^2 Z: dns_marquee.left=marqueewidth+8; |- z" Y+ g7 k/ v1 |
}7 v' p6 y1 @( S. U
}
6 S% I: @2 N1 s `1 x% |
8 L9 e4 P7 \. Y! lif (iedom||document.layers){
. [% e3 ^0 O _# awith (document){! \3 U! ^) \0 c. h0 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, ~5 _- N; O+ B& s% d+ n+ aif (iedom){
1 [4 W+ M0 s7 _# o6 \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- x9 w# o: @( q: owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- ~- y7 ~6 R7 q; q' H5 u- Q5 {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 e8 t9 Y6 |1 {: x0 o: j) Bwrite('</div>'). O9 K4 p" H% D
}
0 e- A4 R- V) b% m5 ]0 i6 T" f$ M4 eelse if (document.layers){
* ~' F* Y5 T% T; O$ H0 }6 cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( r- N& H3 B. p; g1 p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): c3 _' [% C5 {0 o- S
write('</ilayer>')
& d3 Y* S$ a; o/ ?% _}' y3 X( Y1 N6 K2 b" e4 i" Z
document.write('</td></table>')! ]; B$ q, ^3 ^. Z$ U3 ]
}
* \$ D; A1 L8 }}
/ K) f" z# h4 U& M</script> |
|