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

|
网页之跑马灯文字特效
//修改宽度& {' u* B z7 @& b: V7 \/ I% s
var marqueewidth=300
7 y' L) H' C5 p* q1 S% N//高度: u8 F7 f( N0 X; ~; M1 K
var marqueeheight=25
2 T' m2 B8 y, m//速度(1-10)
2 y; J( o$ m8 K0 A5 s, ?# Kvar marqueespeed=3
# H2 q0 n4 h' p* W//背景颜色& o; O8 @, `. {( Z1 P& P+ z- N
var marqueebgcolor="#FFFFFF") ?' c) L# L6 u# E: c
//是否能暂停 (0=no. 1=yes)?0 J- F1 |& [# o1 P8 A
var pauseit=1# n5 l i: E% R$ o4 h1 v) r
; y2 }1 w2 O4 M( o! C* j8 N//修改显示内容
9 w2 E3 p g* w$ d7 z) j9 `( lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 T- l( _; g8 c0 ?$ j1 u3 c3 T; ]5 B; \
3 I" b7 D4 T, S5 X7 u8 L4 B
+ W& A& Q. L3 k& r/ A
////下面不需改变////////////
, N } G- Z! P1 g
) q+ N# B3 K; c2 r- V9 |var copyspeed=marqueespeed* z7 T" {. G. ~. a/ o; j9 s
var pausespeed=(pauseit==0)? copyspeed: 0
3 Q0 A, Q" f$ [/ ^' C: {% E2 Cvar iedom=document.all||document.getElementById
9 W) ?: @! n) O( k$ [if (iedom)
, g' f& F( \5 g _& k# Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! D# V! g6 V Q- R4 dvar actualwidth=''$ [% f8 O( D& k3 E! I3 A
var cross_marquee, ns_marquee: W, T- c9 h3 w1 E! w, o R5 {
% h' T6 R7 O/ ]7 e4 f7 }9 p+ H
function populate(){, i; X3 L8 m+ I9 N
if (iedom){
?/ K( }& A9 i/ S9 C1 {& Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 }5 \( v6 A& scross_marquee.style.left=marqueewidth+8
( C. e$ w- u$ Rcross_marquee.innerHTML=marqueecontent$ U! z: j7 S: z% M0 P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 _( y; g; K0 z$ W, h1 p}$ `4 e) j7 @ n2 [
else if (document.layers){4 K+ h- n _1 g
ns_marquee=document.ns_marquee.document.ns_marquee2: a \, l3 P* t( v
ns_marquee.left=marqueewidth+89 E! Q+ x9 O) b- d9 X, L
ns_marquee.document.write(marqueecontent)4 `/ t% G2 {( \" h
ns_marquee.document.close(); b1 }4 L$ z! }4 ]
actualwidth=ns_marquee.document.width& c- g! A8 Z! }$ ^
}9 M ^; l" A7 t; u/ g4 w
lefttime=setInterval("scrollmarquee()",20). j! u2 ^9 \) G6 g! R! \( {- a
}. A% y. \. {- n# T0 ?) x
window.onload=populate ^3 E; ?. |/ h$ ?+ ~' i' [* N
0 k y7 i) w6 m' ?
function scrollmarquee(){
6 j( P) t8 X+ {6 V. fif (iedom){
( d. ?* C$ Z) k; V$ Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 Z) h) |# D0 [, [' R" K5 _' vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) @; U* \% `+ a# q9 Zelse
: @- O* T) h( Ncross_marquee.style.left=marqueewidth+82 a0 l% m7 j9 p- O
( S8 ^ T+ W! X" V7 P
}- }9 n2 E* f. F
else if (document.layers){
$ m8 a: K" K6 L1 Cif (ns_marquee.left>(actualwidth*(-1)+8))
2 e) b+ B# Z8 M+ ins_marquee.left-=copyspeed
6 N L% c) r {! a5 relse
- A O/ C6 p8 t, ^) Q" Vns_marquee.left=marqueewidth+83 u) s1 ]" J2 G
}& `- R4 i* j+ f& C; j8 x
}9 W' p; D* G+ K, f& E
+ C1 S0 |7 Z6 K+ N) O2 Y
if (iedom||document.layers){
4 A* t4 R/ o/ awith (document){
0 K. K$ S U6 O, k1 j5 fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 v+ E: z! ~* t6 ]% aif (iedom){
7 t) V- ?" O# D8 g& n0 _* iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 k8 F0 R7 ~) B! n" _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 ?# q4 l- ^ ~( ]6 u- Q9 T& D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, f7 O- B; c$ t C$ ^8 W" nwrite('</div>')9 M9 {5 b& y f3 B- H% S
}
% Q; {* M/ k* `% a% qelse if (document.layers){
8 Z! \ `0 s2 c' y9 u7 C# e' W) d+ Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 w5 w2 ^4 }3 {+ G7 Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% \% S1 r# x7 Y8 ~4 d# b& Twrite('</ilayer>')* j) o+ `( F9 H0 Y6 U* F4 V
}
8 R3 l3 O1 t3 `' B0 ~6 fdocument.write('</td></table>')
2 x5 X* M K3 H1 a}2 b& k7 w) ]' n/ l$ p+ j
}: y3 w; u! C. A2 `7 T2 O& p
</script> |
|