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

|
网页之跑马灯文字特效
//修改宽度
1 c( _. v6 g3 @1 ?% B& l8 C4 p- @" `var marqueewidth=300
" Q' y s+ W4 g @//高度
* y- _' |/ l$ R% B6 |7 R+ G c1 V' Vvar marqueeheight=25
5 W( I X+ n( O" |//速度(1-10)' O# A! p% j5 y) p" P
var marqueespeed=37 i' u8 p% K. S6 ]( E- c& A
//背景颜色
% n+ d$ U# U$ l% j. L( m; B/ ivar marqueebgcolor="#FFFFFF") _* y$ n: O0 n: N
//是否能暂停 (0=no. 1=yes)?/ o+ B9 h& q6 l* d/ e% y% [
var pauseit=1 y4 j: i8 I* F/ {9 ~+ z
% g7 F; d# Q# [2 O @//修改显示内容- P3 e+ i: ^- [# x% u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 _ [& ]- T% L
" l1 Q# F% z. Y& i
! p& N/ S0 E* k* D" h////下面不需改变////////////
0 x9 j! W( M* o' F5 c2 Q8 N2 j, i! C; H$ J1 R: }! J; J
var copyspeed=marqueespeed/ m* t- h2 S# o, I3 {
var pausespeed=(pauseit==0)? copyspeed: 0
0 N0 T; I+ ? M# _var iedom=document.all||document.getElementById( |- G: F/ @/ I3 M) j" F
if (iedom)
. z$ y7 {- ?3 J4 c2 t; l( Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# o' B! y) z' F: k; |! rvar actualwidth=''
) `2 s4 ~- X3 q8 Yvar cross_marquee, ns_marquee
' [* v) j; b! h7 ~7 u( R, Q
4 ?# W! J; a$ M, n2 R6 vfunction populate(){
/ f6 x# N9 k" ~" a+ Nif (iedom){8 O/ A: `$ k6 u0 ] @# I1 ]" u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ Q; i( M, ]) j. c( S) G3 R: @7 h
cross_marquee.style.left=marqueewidth+8
- ~) X! T- \; _9 F* [' E1 ccross_marquee.innerHTML=marqueecontent
, k! C# B% C) ]; `0 z0 jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' K- b4 t8 _# ]
}* ?* T2 r) t; t5 L
else if (document.layers){
% x; t4 |0 c" ~7 d& E& D. |ns_marquee=document.ns_marquee.document.ns_marquee2
) v7 }8 u. ^8 a* ^5 U2 i" o3 Ens_marquee.left=marqueewidth+8
5 z1 B0 {, R8 q3 h! n( e: J7 _ns_marquee.document.write(marqueecontent)
" P% o% L! ?! o5 S- Hns_marquee.document.close()4 h; R$ M" c+ n$ P- X2 O+ k# ^# P& F
actualwidth=ns_marquee.document.width1 j* o$ ]) n* b/ W, ?
}5 f% O- A9 _7 Y' K3 u ?$ i
lefttime=setInterval("scrollmarquee()",20)
, k0 b R* Q, `}6 R2 v+ R3 {! j6 {* z
window.onload=populate5 j8 z; y1 b, P- {7 Q
; @" g' A) \* c$ m
function scrollmarquee(){
6 Q. D# Q$ E# z1 e; @6 R Tif (iedom){
# O$ N: |* d1 Z' \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 s+ {% ?6 s2 c# V( ?* t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 `7 ^$ J3 [9 A* i% G$ t. e* welse
+ K/ ]+ Z& g' N# B `9 Wcross_marquee.style.left=marqueewidth+87 w& z% U9 j3 F! o. a5 R
8 H2 l' z9 o! ]/ T, H9 h. N}
3 l2 `; A; X1 n m Kelse if (document.layers){
! u* O9 I( J9 Sif (ns_marquee.left>(actualwidth*(-1)+8))
: R( d \% l1 H3 R9 w: T; Ans_marquee.left-=copyspeed" j, Z6 p/ q0 X
else! I v+ n* l' N, d- w
ns_marquee.left=marqueewidth+8
0 [5 @5 R* I5 M$ }: j3 v* [}$ U- p, |1 g6 m/ B& H9 v0 N M
}" R4 B- G$ Z( g* y4 u# o& P* W. W }8 g: A
1 N1 M6 J# O ^4 b* V5 h; }if (iedom||document.layers){
e7 @5 I6 X& K9 cwith (document){
8 D" J' X- ?- k5 J! r# r& g0 Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# W2 K- M# C' h( B
if (iedom){
0 x6 |( j3 s3 N, y8 [" Q; A1 xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') b4 h% a6 E, n V1 w# y/ z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 x7 i: C1 w v3 }! E, r8 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 O. m o+ G" b7 Y3 Mwrite('</div>')! U- W- L' r! [
}! G# z4 ~) s4 I8 b
else if (document.layers){
. ?$ n, W4 B' \9 G8 O# l) }: d- qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 Q0 k$ T/ T, Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; ]/ i$ k7 ~9 P( z+ gwrite('</ilayer>')
. e+ N. S# [9 \! r& V( m}
]0 X4 p; ~/ _8 y0 r6 {* gdocument.write('</td></table>')
* } y4 Q" A5 f, `& Y, m}
* _: X7 g$ r$ D J# e$ d7 H}
1 b5 Q) B& T6 S V</script> |
|