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

|
网页之跑马灯文字特效
//修改宽度
9 N! j4 K" P2 K4 t' {. Avar marqueewidth=300
. p2 k, e4 ~! T1 s//高度
+ ]8 @3 D* U- u- h5 hvar marqueeheight=25) H- k2 G' s( e/ m! W
//速度(1-10)
& F9 v4 \) M7 B( n* i- dvar marqueespeed=3; g6 e4 o9 I p6 S% X, [; v
//背景颜色
2 `2 P% ^, n$ a# m" k4 Rvar marqueebgcolor="#FFFFFF"
& K# v$ w; p) W2 \! t//是否能暂停 (0=no. 1=yes)?$ e) A( }0 P0 ~! X; }* B
var pauseit=1
! z( U2 N: V2 _9 {0 Y6 d" ^5 }
* [3 t% T8 }& M! _% ]7 [! `& ]//修改显示内容
4 [# Q+ p* e0 \" hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- s2 u4 B1 z/ F! m. e
* T! f6 | [4 c: b7 J, D2 V
0 h: S; C( |! R3 Z' K8 C) U4 Z
////下面不需改变////////////2 L& _: B: x3 u) `, l
8 S; f4 g8 A3 g# E5 `) m2 Vvar copyspeed=marqueespeed( X+ f0 k6 U5 N% p. L
var pausespeed=(pauseit==0)? copyspeed: 0# f q* @) u: ^. Q4 V: y! H0 ^4 }& V
var iedom=document.all||document.getElementById
4 e" |1 ~+ |5 `5 K( c- Z9 [if (iedom)9 Q. t! A. n5 G( B3 Q* S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* t0 Z \) n" d: K2 ?
var actualwidth=''+ m5 k$ n) W2 ?& k
var cross_marquee, ns_marquee& }2 b1 }9 m9 r2 v0 m, {: A) ~
; ^, `8 a4 k- a5 Bfunction populate(){
7 X, G2 t; o3 z+ x" g) _if (iedom){
2 m: D: k2 f0 P: k- m& ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ {3 p, S1 n; Ocross_marquee.style.left=marqueewidth+8# f+ x) n+ G8 q, g9 r' k- K
cross_marquee.innerHTML=marqueecontent9 @# v, b* y& ?0 n3 i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 v; J$ Z" r" `! m" c
}
& L6 m; Z E3 z' zelse if (document.layers){, o! U$ y8 t: i8 Y/ @& R
ns_marquee=document.ns_marquee.document.ns_marquee2
0 [) g. L1 O$ Rns_marquee.left=marqueewidth+8! P4 v! e9 P o/ P" K, R$ f+ b! M8 i; @4 f
ns_marquee.document.write(marqueecontent)
2 }7 h2 D$ H1 t7 p% ]ns_marquee.document.close()- s9 e4 A* O2 d$ u3 b
actualwidth=ns_marquee.document.width, C' g0 I6 z+ F" g7 Q0 [* k3 y
}
- ]+ u, L4 M+ i8 D2 R% O: u Ylefttime=setInterval("scrollmarquee()",20)" E$ Y2 P @$ a# e9 ?
}
& Z/ V; _' t( a3 L+ a' ~window.onload=populate
. A' f* e4 ]0 y5 p3 m! E) j; e6 E/ q6 ]& _; j+ n4 V- c% B
function scrollmarquee(){
+ Y: U4 n2 u9 `- j6 D1 ~if (iedom){
& e6 P: ~- a1 h+ Z: M" k; T* v) ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ M) f- c3 {- [: k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! r6 x. A" V6 |$ M3 r: V
else* E8 m, k c. f4 L' \ Z+ `$ s
cross_marquee.style.left=marqueewidth+8- A: Y+ u1 P# P+ D2 `/ b7 P$ n8 i
, E" k6 q; m/ N. o. c9 r! m% ]5 w}1 t! A5 V0 y* d, E
else if (document.layers){; z2 K$ _. Z! G* c
if (ns_marquee.left>(actualwidth*(-1)+8))
/ w+ T2 m5 K" U! u) Z4 m/ ~5 ~ns_marquee.left-=copyspeed" f$ S3 |/ i: n! \( \
else
9 I) R6 e3 L9 Q3 A" S9 ans_marquee.left=marqueewidth+87 ~" V( A& G- S3 F! s
} p2 Z% [! E4 g7 G9 _
}
; ^4 f5 ~% [+ B, ?- C
6 `6 ^! I% P% \if (iedom||document.layers){# X) w& l, p7 G H+ s
with (document){
0 [" U5 k* k% P+ l6 Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: k5 O6 c& k* {( O4 g& a: F. eif (iedom){
: v$ l1 O& u) @# Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ {8 \ X, h+ E, Z0 F8 k1 v: fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 K% a a8 Y# ]/ }6 M# S5 j' g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) d- X( ~% a: x3 Z/ swrite('</div>')
" T6 |2 ^* I S}
l, p1 h2 N0 G; G& n% X" M( w' Kelse if (document.layers){1 |+ u2 |8 U3 a) s" c2 @% P. V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 l( G5 B( c' Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( v# L3 Z7 s* C; f! S+ w
write('</ilayer>')/ J0 L7 @9 g$ ?
}& M1 \1 v9 @. B# C
document.write('</td></table>')" s) G* B) r+ ^: o0 {% b+ R) N
} C8 M3 ~8 ]! J
}
4 m5 Z9 E% D9 H& X- ^</script> |
|