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

|
网页之跑马灯文字特效
//修改宽度
+ C& N5 t! O1 q5 U9 y) o( u- dvar marqueewidth=300
/ ]' b, L1 [1 W9 B- ]$ i; t( ^//高度
0 g# W0 H' I4 B3 D6 j9 n; g* l: C9 j* |var marqueeheight=25
$ X% _5 b; v( n% B1 g# k9 a0 }' @//速度(1-10)
/ m, x: v2 f5 F" |" Bvar marqueespeed=33 E3 L: L% g1 j1 E( R; @9 X
//背景颜色
) x% e/ A) t% n) B7 v. U( Uvar marqueebgcolor="#FFFFFF"' [# G, K. N8 C9 k W% Q: G& b: c1 [
//是否能暂停 (0=no. 1=yes)?
4 s/ m6 ?, c+ \( }% V3 s' ? e' D: E( Uvar pauseit=15 k& m9 I' M V) t4 Y
* d! H( l$ }' y8 e//修改显示内容
9 [7 G, ^4 k; N5 `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 Y8 u/ k# }" A ?% d5 s
. k, n# f- m6 I. `2 q5 {
3 H4 y7 d" y" B////下面不需改变////////////
/ N. _; y9 [# o" [* e7 I$ x( B0 p- A/ e
var copyspeed=marqueespeed
% r; A5 r7 ]& w# O! ` z J, ^, ^var pausespeed=(pauseit==0)? copyspeed: 0
. S* b8 j( r' _$ d Hvar iedom=document.all||document.getElementById1 V# N2 @& G2 a0 y
if (iedom)
( q+ J0 n. b- M$ Y7 ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ |: P7 e* Y4 F* k
var actualwidth=''
. c7 H) |# G0 svar cross_marquee, ns_marquee$ C0 o3 E0 h4 m
' \9 n" i- @" \/ r
function populate(){
$ K5 E; z% u1 e5 ~if (iedom){
+ \- ?" @# L# ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ _1 _+ Y: l# I0 `/ }' z
cross_marquee.style.left=marqueewidth+8# r" o4 M3 P/ c' z+ t# F
cross_marquee.innerHTML=marqueecontent
+ o" A- v9 q7 ^( N' i8 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 m2 |* R1 y6 r% S
}
7 q, B x& B: N5 h) d. f+ w4 Xelse if (document.layers){
+ s6 W" M: f' k8 O* Lns_marquee=document.ns_marquee.document.ns_marquee2
0 G6 N% |( q& t/ |ns_marquee.left=marqueewidth+8. ?, R5 B* t% Q. g7 s: X2 m6 K
ns_marquee.document.write(marqueecontent)
3 X1 w4 E/ X5 O6 C! L( ?; W# ens_marquee.document.close()* F2 H1 J. w0 t/ p
actualwidth=ns_marquee.document.width: Z7 \& ?2 ?/ R
}1 ^; f" A0 O* M4 X- B3 ?# S
lefttime=setInterval("scrollmarquee()",20)$ o# z: X5 @; y$ v0 k" q6 `3 A
}
+ e3 y4 s2 _+ E% \0 H H1 O' G+ o. p! Owindow.onload=populate! F" m2 r2 U9 z R
; W% R3 f9 Z" i; s+ ]function scrollmarquee(){3 @& X- G' P" J* x6 V4 e( i
if (iedom){' \$ y1 A! `2 x3 x! \0 G# Y& ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 X" ?, k: U8 i: ^3 Y1 M" {2 jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! I- V, h! B! h* `% n: `. T: welse
1 C3 W4 ] ]6 `5 T9 E7 z9 N) kcross_marquee.style.left=marqueewidth+8
, q% l$ o% i9 e$ f5 n& g+ F
4 Q1 B( o* g. E# t# D& k* _* r- B}
, q1 {. Z2 l8 m- S" i/ t5 Z) oelse if (document.layers){
. c/ {* h2 q; C7 i$ b$ Vif (ns_marquee.left>(actualwidth*(-1)+8))
* W8 \+ c8 E- n6 s0 Yns_marquee.left-=copyspeed
" m3 z( u" c3 s; M. h; Velse# e. I; B1 p& D* [# K9 _1 l9 l/ n* {% k
ns_marquee.left=marqueewidth+8$ Q8 s( }1 m: Q; S2 ^4 a' V M
}
4 X; Y: \6 E3 J5 ?# |# }}2 T6 e8 z; k: q7 ]3 O6 L) o
& X, f- I" b1 h- x( U8 iif (iedom||document.layers){
0 V4 I. \. }; N* Q n2 z! r7 dwith (document){
( ^. r+ s- w( a- C2 X( { Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- I0 \ i X z0 w5 K( W e9 ^ c1 O
if (iedom){
2 M I9 H# k, ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# r( ~5 Y. [2 w7 |8 Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- ?5 v' x, }7 g1 Q% B" e5 t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* |2 v- U4 B9 D7 c1 O( `& iwrite('</div>')
& w& n1 k+ ?" }4 ]( ]+ ?: Y1 @}
# H" C- Z" E' I6 Selse if (document.layers){
* m, N5 m3 b2 Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. V* z2 X9 b8 s4 q& B, G; nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ Z' y% f- b- p8 Y k8 p6 [write('</ilayer>')
& z. I* V! `8 Y}
3 Q7 B1 p5 Y2 @: j" z' U m- Rdocument.write('</td></table>')
5 n8 u, S6 C9 ]9 r, b1 B! M5 G}
4 s/ C% C9 y2 Y: F3 `}7 f; A6 K* C r! ~) D8 D2 t% t
</script> |
|