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

|
网页之跑马灯文字特效
//修改宽度
9 m$ ]" G. U$ O$ X4 nvar marqueewidth=300
: W& ], g4 V4 B! W) W4 V# o5 S1 g; u//高度
s/ V# t+ c* s+ a/ Cvar marqueeheight=25
5 u' m y8 G2 n//速度(1-10)% e7 \) Q" ^+ V1 K0 r0 Q5 w/ E
var marqueespeed=3
+ F% X& d. O* e; P: \//背景颜色
- Q- ]4 |" a, a, s* v! `var marqueebgcolor="#FFFFFF"
+ _* U7 p, T% `7 }. S, R [//是否能暂停 (0=no. 1=yes)?
. |/ [6 G, |5 G# S: D5 nvar pauseit=1
6 Z, F+ ]/ l5 E: C- I4 A5 U
5 r' J) U' J2 \$ C. n: F7 f//修改显示内容
, x8 v$ H! B; A7 L6 u3 L5 x5 yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' ~% j$ N( G$ B. O
, w6 p# v8 A& T" K# V" t* A* x. k8 T6 k" c' n2 N
////下面不需改变////////////" s" g( g3 E2 Z" h3 I
( u* f2 S5 [8 Z8 T: Z/ v+ D% n6 fvar copyspeed=marqueespeed. M0 ]6 v6 S& n, ^4 P+ D" }
var pausespeed=(pauseit==0)? copyspeed: 0
! e0 @8 y# u) ^, p7 M! C8 Gvar iedom=document.all||document.getElementById
7 I) c! }# E! Z+ Q0 bif (iedom). e$ v; v# p, k3 @) d/ U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( f3 P: ~. E7 S- S4 M
var actualwidth=''
9 A7 B) e' @& _! V( Gvar cross_marquee, ns_marquee' @3 U6 K; r+ x. w* h6 z, |
% F8 E# L; Z% y3 Q- f! y. tfunction populate(){, d5 f, k% F9 D) W! Q
if (iedom){
7 u c' K% B3 T6 ?* X- rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 V' o4 U4 R, b' Y& Kcross_marquee.style.left=marqueewidth+8& d. V% F, }" n$ }# `; g3 {" n% p
cross_marquee.innerHTML=marqueecontent1 l6 p+ B0 o2 e; V9 Y2 i5 T6 `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 j6 r: z/ R4 T: [5 R}
2 B# R* ]3 _$ ?( d$ s9 z$ ~3 n% Qelse if (document.layers){
0 P# i5 R- z- D) E! ~! E9 ^ns_marquee=document.ns_marquee.document.ns_marquee2
# R/ ~2 z1 s- _2 J" K5 J' \0 hns_marquee.left=marqueewidth+80 v e- r |5 N' o4 ~
ns_marquee.document.write(marqueecontent)/ ?# E( X/ }* U& k
ns_marquee.document.close()% Y6 \7 ?3 V( S7 ?- E! p
actualwidth=ns_marquee.document.width
% c8 d7 B' Q7 _}
+ j) X, l: d) x6 ]" O. ilefttime=setInterval("scrollmarquee()",20), M3 H2 z1 Z! R" L+ P" G5 p/ H5 e+ j
}
6 }/ g3 n1 Y. B" S+ l% mwindow.onload=populate# M' k+ I6 e; y7 W- b
! {; _) }. Z0 D% K) `* p* F! _function scrollmarquee(){- z+ _# n4 T1 G5 b1 E
if (iedom){4 r4 i0 _1 E# s5 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# W% Y' A& `6 r5 B t6 a, l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- f" q$ g) }1 Q% w6 _& R3 p7 [: b
else
' }1 x" F7 C# j6 J! A. Ycross_marquee.style.left=marqueewidth+8, d: K+ e& A7 ^9 B [4 V
" ~$ U3 P8 F+ d}& O5 K% {& s1 V$ I( s
else if (document.layers){
/ Y' W+ q7 t, D( Hif (ns_marquee.left>(actualwidth*(-1)+8))! S( G& ~# v4 \* H) y* J
ns_marquee.left-=copyspeed6 B. }" J! g2 t3 p* u
else+ P p4 A: @4 c# S
ns_marquee.left=marqueewidth+82 s5 q' A8 |" b+ \. E4 Y1 b
}# p$ d9 ?: a( i; c. f7 |9 \
}6 m3 c) W7 \5 h- z! R
* p0 b" n2 }2 T- Z. `7 Q+ b6 `" B
if (iedom||document.layers){
- l2 U0 b z' a+ Dwith (document){
" H G4 q. ]* Y' e1 j; vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) {) d' D) D& b: [) S( v/ Kif (iedom){$ h! @% G4 B0 @# Q7 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) R- F: L2 s: X" Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 ^: v7 [- F$ N4 t7 ~% zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* t9 F$ w7 z8 {8 b' R! ^
write('</div>')
* ?$ a& d& l7 Y. A0 X, i( e; _! Y% v' \! W}* X* N6 f4 |2 Y* j U
else if (document.layers){
6 }6 y g! O4 U' E. O9 |4 {2 Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). a* O E/ D) t7 V9 O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 n( x& }+ h3 d# j1 \1 O& [) E3 D0 Owrite('</ilayer>')
1 L) u) V0 K1 r9 o* `3 @8 E( z} ~6 T) n( c2 C4 j1 s/ U! A
document.write('</td></table>')
0 k. l: `5 V, R" t5 c: L}6 S% V2 K0 l* v
}
N8 c H4 }; n6 b+ d</script> |
|