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

|
网页之跑马灯文字特效
//修改宽度# ]! o$ I; n4 z: p# c
var marqueewidth=300
0 M+ x/ B$ `! p/ u//高度
" N% o5 ^5 }4 g" K1 A8 [var marqueeheight=25
' o9 d* E& U8 M% x+ Z4 q//速度(1-10)
$ y$ s; V r7 O+ Kvar marqueespeed=3+ I2 _- h0 G; w( J( y
//背景颜色
* N0 Y3 F. E$ [* ^' G" T3 Yvar marqueebgcolor="#FFFFFF"
1 w# \6 w* ]) e% k! U//是否能暂停 (0=no. 1=yes)?1 u4 s2 @- `. K( [+ v0 }
var pauseit=1- [( a3 j7 E" M! }2 ^# O& Y2 c, R
5 r! H! R$ Q+ S
//修改显示内容+ q4 o/ {6 h6 R4 B1 `* s/ `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' J J( x( `/ f& \2 O
6 f1 s0 n) Y$ K3 ]; x. [0 a4 D6 Y# I c
////下面不需改变////////////
- H* a( N6 n7 q7 s* g" m0 P) x1 R' H9 s0 Z+ j
var copyspeed=marqueespeed
1 E) `& A ~2 U5 y. a5 K7 |var pausespeed=(pauseit==0)? copyspeed: 08 p. P ~8 t. g4 T4 x
var iedom=document.all||document.getElementById
x! i# p* v& Tif (iedom)* b( q# m/ j* {; q# x5 @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* E0 T! N1 V+ ]! s
var actualwidth=''2 U, ]# g" Z4 D/ k
var cross_marquee, ns_marquee. L* `8 }$ m- l: A" h. O
& B9 F6 n9 x. `7 d6 Kfunction populate(){, Q8 ?; O" m3 H- x. I. x: [) I
if (iedom){
: T' j. r% B5 d- Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 n! @; A3 ~ {1 z: U$ K! h& Jcross_marquee.style.left=marqueewidth+8
5 O1 m# \, O1 _1 v( Qcross_marquee.innerHTML=marqueecontent
/ M4 R' P" M* C6 u- I& W/ l h3 Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 S9 ^: Y& k2 k& |4 W5 b1 K
}
; g0 i/ _' O& X! |/ E! ?$ uelse if (document.layers){9 Q% T- Q: G, a L$ I/ w/ d
ns_marquee=document.ns_marquee.document.ns_marquee29 P2 _7 g* c' z
ns_marquee.left=marqueewidth+8
8 |: E" Z% G# c: v) [% {ns_marquee.document.write(marqueecontent): G8 @/ S6 D3 Y$ r" \1 G/ M
ns_marquee.document.close()
& a/ I/ P5 z3 E) H s( ~' i6 c- F1 ]actualwidth=ns_marquee.document.width+ A) J' M; c9 F6 _( b" S7 _ j; f- R# v
}
5 l/ g+ Q9 w9 E9 H. Klefttime=setInterval("scrollmarquee()",20)9 u. W% S7 k0 F# @& ^' q3 [, D8 {
}" ^4 k$ |2 Q) a) r: o6 E% n2 L
window.onload=populate* |" G- W# y: F2 D6 y" g- S
8 F; j% a _6 _4 Z/ ^9 kfunction scrollmarquee(){
' d9 n* t% A. H% bif (iedom){( c& I2 g* x9 N& J2 ]9 M: E1 i& C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 G% m! A7 U8 [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 G$ U5 @! E. i; selse
& W/ {, V7 ?& X9 ~8 [& B& ?cross_marquee.style.left=marqueewidth+8; |) z) r4 L# @1 M
+ ~$ J" M. z# H" v1 g) [+ z1 x$ e& _}6 j& s u( g" q& q" R
else if (document.layers){
' [9 ?( `7 j$ I2 ]if (ns_marquee.left>(actualwidth*(-1)+8))
5 Y J" u# m9 l. h5 g8 ? O1 ~ns_marquee.left-=copyspeed0 ]5 m3 ~% Z: T- x2 K
else
F' Q* o! n$ V1 R5 s" h( bns_marquee.left=marqueewidth+8
9 K, R0 ]' o8 S* m2 j}
$ R% o* ?3 n- r7 z. z- J0 m4 i}# m" h( g. P/ R+ P7 x
. F+ u: R* P8 }" L M# fif (iedom||document.layers){
4 V2 P! A: h) t `3 Owith (document){
$ K2 {5 j& p% n% B, n! T# @) S4 [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 S# w. w- `5 d1 E
if (iedom){: T3 x+ W+ Q' [1 \. D6 h9 p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! c- ^. L5 M7 x- z1 Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 _" p# P. C6 f5 L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 ], X' j' l' z2 ~" V; G% d% a7 fwrite('</div>')8 H+ @3 u& O% E
}
/ `+ j, H- y# K7 Felse if (document.layers){ I6 q6 [" v3 F7 `: Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 _! T1 ^: r1 y2 _+ x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% ]- E; j$ i+ [* |( r; bwrite('</ilayer>')
# W: x* f* V+ ?- Z9 W}3 V U% X9 X3 F- m& N
document.write('</td></table>')
0 z( C& K# R" T4 R}
+ k9 d0 _( {3 |+ _6 l}) v2 i8 U, D7 k1 i4 T
</script> |
|