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

|
网页之跑马灯文字特效
//修改宽度! O0 q- b6 \7 f5 @/ q
var marqueewidth=300/ f8 u, \: b u2 S
//高度7 D" j6 D& t" |1 l5 n% s
var marqueeheight=25 y7 i! [6 D( | O8 [
//速度(1-10)
' T' W, Z2 V1 Y0 N# e8 kvar marqueespeed=3
: s6 N% D6 i& j/ ~) w7 S+ ]//背景颜色& x0 _, b5 }& {
var marqueebgcolor="#FFFFFF"
+ ]3 L6 d! E; {0 p//是否能暂停 (0=no. 1=yes)?
; B! N" B, m% g8 m8 V* _* Zvar pauseit=12 G( P0 y' p. {9 A3 \
- z4 D* V& V% h' w8 x6 e! s# l
//修改显示内容% u H0 f& m% Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 p4 j6 b) P, Y2 i" B3 Y- f
( \* U& s- O) k2 [# h
9 {* y! N5 `% l////下面不需改变////////////, f4 V8 ` s) `. t
5 @8 y& U9 g/ H9 g$ i) S/ n
var copyspeed=marqueespeed. f( H/ {+ o2 ?2 O; n o, ]
var pausespeed=(pauseit==0)? copyspeed: 0
) I: p: m9 \6 U& p; ^var iedom=document.all||document.getElementById
* x7 j! l% j( m% y4 \4 b# _3 Yif (iedom)5 {, q: L! J) b7 e4 C+ W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 u# B0 o/ [3 G0 B
var actualwidth=''& M$ N' P5 u; \* W* B3 A2 g1 K
var cross_marquee, ns_marquee
( T5 ]; Z% [# F+ ]) j
! o" {( _2 t; cfunction populate(){
- o2 m5 H2 D4 M- m' nif (iedom){0 _; ~' R5 k) }) ~& q! m7 {: z( ^7 v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 L; R7 `1 n: ?" q: f T& mcross_marquee.style.left=marqueewidth+8
& x8 y: q4 T; r1 i+ q+ Kcross_marquee.innerHTML=marqueecontent) P( y2 [5 x) @, t) Y, N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth c$ }9 |- E. E2 B: |$ a, y" T3 w7 l
}2 w0 ~0 D+ k! C. ~$ Q; ]
else if (document.layers){. P8 n) L$ c' {. K
ns_marquee=document.ns_marquee.document.ns_marquee2) [% E+ `: k8 P4 W8 F3 O
ns_marquee.left=marqueewidth+8% Y& B& y6 l# c, s
ns_marquee.document.write(marqueecontent)+ @3 _. S7 n9 i6 f) O
ns_marquee.document.close()
3 @/ k' }7 w. d# g4 ractualwidth=ns_marquee.document.width/ C0 }) M8 L2 d& q3 _9 r2 w
}( g' G' G- m7 Y. {6 u
lefttime=setInterval("scrollmarquee()",20)& e; K! K0 b$ G- x8 m% `
}# A; t j3 N. o% X: K; d
window.onload=populate
$ u7 r+ I4 Q, Y. L- W
! E1 T' H) ^2 W7 l- s& M1 _, gfunction scrollmarquee(){
) C7 X2 q6 Z0 g! Jif (iedom){
5 r+ M; ]# x% B0 @, b2 O. Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 _6 H) A/ R' k, mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 Z% X- D h, [5 lelse
9 E8 N$ |. s" f& H% ocross_marquee.style.left=marqueewidth+8
( V# ^# ?6 @% t5 T8 ]. T! z/ g9 O: y+ p6 x& K0 v
}
9 e) M+ s4 Q @, k+ W \else if (document.layers){7 z" _9 R; O2 `& |1 Y" U
if (ns_marquee.left>(actualwidth*(-1)+8))* p0 @6 _7 x7 M4 _* _
ns_marquee.left-=copyspeed
, N) t9 D& Q5 Q/ ]( ^else
8 v: @: t; M ~7 C( Q9 Gns_marquee.left=marqueewidth+8
' x J) c/ U7 j9 w ]0 I}
; M, Z3 i+ q2 z- J/ K+ e: l}# U1 g0 `, L y' S3 V* I( M
2 S* s: Z& x9 g0 p2 }% T0 i& u' Z9 i
if (iedom||document.layers){4 b* I0 A9 n. R1 q: Q
with (document){* j& D: B; Z% j6 Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 p9 A) O) \ {3 {* [. c5 Gif (iedom){ @- P) p6 ^' e" V* I+ w0 c& i
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 D8 O( e2 B0 |3 Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, s! I; ]: g# _# e& d# S8 i! J* ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): k5 n( q: D8 N' a' V5 a
write('</div>')
0 ]9 q6 }1 Q6 W7 A}- D8 Z- ~/ x% g }
else if (document.layers){
: M+ I. h# j7 B7 t2 qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& g: a- z# O6 w( q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
E8 E9 _6 ~, x1 ^) Vwrite('</ilayer>')
+ [" M7 }" f2 o V2 w}5 Y$ K& z+ r) h2 |: D
document.write('</td></table>')8 I O" j1 j. X) Y: e. ^3 l5 H, n/ [
}! h* L$ I8 C1 F. R3 x8 d- {
}
) M# U. i9 [ ]7 G( u</script> |
|