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

|
网页之跑马灯文字特效
//修改宽度
" j4 x0 A) \% Svar marqueewidth=300" B+ v3 J5 s& T/ @: y
//高度
6 m, n2 f. w- Y' Avar marqueeheight=25/ B o: }5 S# ]( E# j
//速度(1-10)
2 g- T3 J5 E- \7 U5 I' ^' Mvar marqueespeed=3
1 C2 j) Q: [4 l n( K* ]5 Z" ]//背景颜色
1 B6 ~ `9 s/ W5 P+ g7 C8 O4 Gvar marqueebgcolor="#FFFFFF") i$ Z! ^2 _ F1 P& n% _: v* p
//是否能暂停 (0=no. 1=yes)?7 C+ b/ T, D4 t, |/ b: L
var pauseit=14 v0 a( [: L9 p1 }& _
* f' n& p0 E% C# |, k//修改显示内容
% e; l# _' W( V5 M: hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( T' c8 _# C' |, B1 y& }0 Y
3 c% r3 n! H* ^ k% \: J; J! e
9 N- ~. a) b$ O
////下面不需改变////////////! N Z& h! l; t8 G8 B
; r+ g, l1 e M; ovar copyspeed=marqueespeed
- U- p c. @ c5 u0 l2 L d5 W; Svar pausespeed=(pauseit==0)? copyspeed: 0& Z6 T. Y+ b' F; D8 _- Z
var iedom=document.all||document.getElementById
3 S3 p4 Q2 o9 A' Z4 cif (iedom)$ m* F& i1 F. C0 e' B6 D! Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 Y1 O" m+ A+ C
var actualwidth='', z& l" X. \- h3 L: O/ h& b. j& }
var cross_marquee, ns_marquee- F U, I/ x& I6 V! n @
! \; z' T! o; e# P; M- J/ K
function populate(){" j/ C) H3 e0 I. X4 f4 t( d% h& a
if (iedom){
: G! J" \. ]0 x( e4 jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 J$ y' y4 ?4 s: |9 Y5 @, V
cross_marquee.style.left=marqueewidth+8& N# O. r- [- a7 A3 @& ^
cross_marquee.innerHTML=marqueecontent( _ E; R, v2 L! G2 C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( N# z$ _- I3 { l2 R
}6 g7 ~5 H* M9 ~$ k$ g# J5 M( s6 O: D E
else if (document.layers){, d6 I; x6 [1 t" H7 d) I
ns_marquee=document.ns_marquee.document.ns_marquee2
8 `% g [! I. ]ns_marquee.left=marqueewidth+8. | C) a; V& X2 ~
ns_marquee.document.write(marqueecontent)
+ N1 j; n% q7 h# f6 h+ a/ h" Jns_marquee.document.close()
7 s& |/ F/ z; U; d; Y/ Jactualwidth=ns_marquee.document.width
5 [- A A" x' W8 w$ ~) `9 e}) H' j% z2 N2 s7 O5 A
lefttime=setInterval("scrollmarquee()",20)* }& b+ G7 u2 W* x% ~# x
}
0 x& d% w% e+ J' L$ i' N' ]window.onload=populate
- S- S5 ^% P% C$ B4 z' n$ Y6 Q: B3 q3 w
function scrollmarquee(){
: a9 E' b# @( s: }3 ~2 eif (iedom){3 e- A' d7 V$ i9 v. `4 J$ f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ ^1 ~3 o9 J; R2 I. q, lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 A! `; h3 d7 t
else
& T$ b" b9 A; lcross_marquee.style.left=marqueewidth+8
4 z: S7 S8 z: l9 v7 ]7 e2 F7 T
' \7 \/ o2 }: [3 [- E5 K* f}
/ m7 g7 g* E# M& ^else if (document.layers){
( }+ i! y& Y5 \( Hif (ns_marquee.left>(actualwidth*(-1)+8))4 J9 j: g5 b3 [# ?
ns_marquee.left-=copyspeed
8 K( \6 y: e. w8 o$ j5 e3 b' Zelse& a7 F0 b6 A; t" x8 ~3 |0 V0 p
ns_marquee.left=marqueewidth+8
" A- R* N# G1 H}0 P w f1 T/ w5 R [" O: a
}$ s& `% s" D, v
2 V% Y) `, d% l. q& c7 Q, p
if (iedom||document.layers){
9 I. }; f* }8 ?' l1 fwith (document){
( S- U/ q* H: L9 Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! F& |8 \$ u2 \8 O6 V- ]3 s
if (iedom){. J" g4 z4 M+ g9 C0 \+ Z1 T, z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 y4 Y( a* D1 R. n6 @7 h/ L, j' X, cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# D" @0 v7 B& A+ Q3 h+ q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 b& c5 W5 Y! q( g* B; d, p( N
write('</div>')* E ~$ u: t5 X. p* q
}
8 Q; _+ J M( A) h6 Oelse if (document.layers){
: X- C- y# X# C# U3 O( h) vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& h1 { Y+ M$ jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- l9 x$ k' i7 y- W: v5 B8 U3 uwrite('</ilayer>')- u9 W7 S& y; c
}' `9 B9 J: ^- E9 T+ |3 M3 s% Y
document.write('</td></table>')
0 ~% J* t/ g& z- Z! v8 X0 j. o6 Y}
1 N' o( r3 f, A$ ]0 W4 o}
3 q; j9 g1 y5 F. U5 ^</script> |
|