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

|
网页之跑马灯文字特效
//修改宽度* K/ N$ N% B9 C# h9 z! g g* ~# a( G
var marqueewidth=300
( S! P( r' j* `//高度
: y7 m% ~, o" f( v- J; |) p$ E0 L4 ovar marqueeheight=25
, X1 o/ I0 C5 Y5 F1 c- d, U6 V//速度(1-10)7 i" p( L/ a9 j" e
var marqueespeed=3
) O! W, f7 M) o2 _; l//背景颜色
5 }7 E' E$ @* p) i; [var marqueebgcolor="#FFFFFF"
! r: g& }8 }* O6 I//是否能暂停 (0=no. 1=yes)?
1 p: V( @* v* v: t8 q U$ jvar pauseit=1' z" b" c8 T8 P8 g9 E
. z+ S" M9 n" h" W. F5 n//修改显示内容1 Y: U* K% T0 I; u$ h3 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' c, j( f- r3 s) W5 N
( z: t- S4 i6 n. J+ h, ?; M
+ t/ `* l! h/ p9 {; C////下面不需改变////////////
* _" a/ h9 {$ o6 h' ~3 g. m2 B, V6 x
! Y) @$ ]5 Z$ R) }var copyspeed=marqueespeed
3 ~7 s/ c" b0 ]- ~var pausespeed=(pauseit==0)? copyspeed: 0: }! d7 F7 p: L( y
var iedom=document.all||document.getElementById; p) A" D' q7 M$ ]
if (iedom)7 N6 R6 T: b( H4 P# G. |2 D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). r" f" c* j. M/ y; [$ y1 w
var actualwidth=''3 r) O# R7 s9 ^ l# W$ W
var cross_marquee, ns_marquee- _' Y0 M* H4 d1 ^$ `2 i
/ }6 y5 L4 j+ Q) m1 \7 B% [function populate(){
3 j9 T6 w: @$ w, x, ?, g4 uif (iedom){. g# k9 B5 `2 X8 m7 B4 r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 ?, I9 i4 h, t0 v3 Z* p+ j4 P
cross_marquee.style.left=marqueewidth+8; a7 r+ [0 t1 a" A8 N& L3 O
cross_marquee.innerHTML=marqueecontent
9 Z! X7 K* K6 d ~- `0 ]( jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth {! e- C1 y7 G' I; F0 L! j' u# q
}! U$ R' W; w$ ~- g3 p. s
else if (document.layers){
# U' J2 h- I# {' X9 U6 o' [ns_marquee=document.ns_marquee.document.ns_marquee2
2 X- Z. h( x) o! n# ens_marquee.left=marqueewidth+8
1 B2 T k% ~8 p5 X1 a8 X: g1 i3 Pns_marquee.document.write(marqueecontent)
: o) Q2 w, Q# Q6 \# Pns_marquee.document.close()
1 k. B/ r: i4 O( [$ w) D v: Bactualwidth=ns_marquee.document.width& J4 {& u' U9 p8 t' A
}
2 X$ b- X5 f/ V9 g0 X4 Y* E6 llefttime=setInterval("scrollmarquee()",20)
% i* p0 ?% a: q% v}
! I* h, v' ^5 ]' Iwindow.onload=populate' P& j. X% S8 F4 p* ^( ]
( L& q. S1 Y7 L' x# I
function scrollmarquee(){9 g1 X. T! y& v$ k/ ~
if (iedom){
7 f3 O* ~2 [7 V- C+ Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ q w8 [' x5 j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* ?( r! C$ T. s$ V
else
\8 Y; N: j+ N) T; dcross_marquee.style.left=marqueewidth+8
/ ?' T' P9 K. n2 Z6 u
6 o6 G# m- [+ _3 s2 q}! L% c/ M6 e3 H% P$ E
else if (document.layers){& N) Q" k( }' _6 y+ {) ^
if (ns_marquee.left>(actualwidth*(-1)+8))
8 H% ^4 T- O8 Z7 C9 t- u, J J' rns_marquee.left-=copyspeed
, o9 p# r! l1 F6 k9 l lelse
% `8 g# ?5 o `; g6 Hns_marquee.left=marqueewidth+89 F# Z/ Z- D7 S5 @4 R
}
3 k7 s8 Y% w" K( k}
0 W. a0 {3 k. D2 [; c1 q
" o6 c$ p4 f1 nif (iedom||document.layers){
6 b4 m$ U' x/ L9 t. p0 Kwith (document){
" N9 h/ z3 d. c7 l( L. s4 d) ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, B- Y9 q) l: \if (iedom){
! J3 t) t2 A8 N( Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 h5 D$ l* Q. T+ s8 A( f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 j* _3 y3 _, K1 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 R5 o* t. }4 l4 M5 @2 i' A' C
write('</div>')( K/ ]8 |6 @$ h8 O
}
$ b, x1 D! r1 w1 X3 nelse if (document.layers){( z& \# S# U: _; e9 u2 r9 b! r( H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; n$ n, t, }) R. q% }/ Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 ^: ^, f5 k1 X. r9 F; c
write('</ilayer>')
% h1 c) K, D7 m}6 ]6 p. a6 N K1 d& |
document.write('</td></table>')8 D' B+ k+ d9 ?# H, m c# J
}
- q8 V9 p8 T2 v4 N' S- B! I$ ~5 m}7 u1 s) q) g7 f; {' E+ D6 L$ s
</script> |
|