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

|
网页之跑马灯文字特效
//修改宽度 i' X3 p4 q3 h- ?* h
var marqueewidth=300
7 g; |5 o4 T4 P//高度9 k6 E3 x3 J! [
var marqueeheight=25: i1 y- U7 B5 U; _% x
//速度(1-10)
$ T9 n T) f6 Rvar marqueespeed=3
1 V! _7 L& q) F0 @3 _" ~//背景颜色" t8 o2 h. u4 j! ?' @& l$ q0 m
var marqueebgcolor="#FFFFFF"& Q6 ]% H' |& _
//是否能暂停 (0=no. 1=yes)?
# F( t" e9 {! D" b' C* b3 t4 Gvar pauseit=1
) @) M' H7 r5 x3 Z
- [+ I) x5 B3 |, f//修改显示内容
( D9 B! J' t, O8 Q. C5 Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 e# [- o+ S* V; s* t6 ]
" M: h9 E& N" }3 j f/ ~# ^( p
* p# c' b: V" o' X////下面不需改变////////////
1 K% H: C e6 c5 M
% `, D7 j3 f! Z3 Svar copyspeed=marqueespeed$ k' Z$ A1 A! X. Z- i
var pausespeed=(pauseit==0)? copyspeed: 0% T: M' {4 p' j9 M3 R y2 [: O
var iedom=document.all||document.getElementById" E. x; Q* T/ {+ m; x# d9 U
if (iedom)
: V* [/ p- H, Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ w/ Z$ Y$ H' [; s/ m$ p5 E7 H" x# Z- p- uvar actualwidth=''
& r- s: X$ X- W' [0 Z# v3 M- [var cross_marquee, ns_marquee! t) y- e- @- [" ^( q2 W$ U
* A$ R: K6 u# q' G/ {* d: @4 z; Y: f# ofunction populate(){ R& G0 d" A: O# W! a+ d* Y
if (iedom){, a. `2 e5 ]7 ?, R u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 j% Z" Y9 b5 E% ?5 z
cross_marquee.style.left=marqueewidth+8
9 u, l# {& O! a! zcross_marquee.innerHTML=marqueecontent& ]8 X2 v9 Z- b/ j6 A) _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 `# y% h9 u1 U o1 c$ _
}
( N L# C) o0 i F8 h4 Gelse if (document.layers){* s- j) g2 ?1 G8 N9 W* T2 i# Y& {
ns_marquee=document.ns_marquee.document.ns_marquee2
* h1 N, ]( W8 d8 l2 Sns_marquee.left=marqueewidth+8( X( A/ @) ^+ x0 c# h# ~
ns_marquee.document.write(marqueecontent)
H W7 D. c' d, S; Wns_marquee.document.close(), u+ _. q% W$ t. `; y. z1 b) R" Z# ?
actualwidth=ns_marquee.document.width
, W% u2 R! E7 n O- L}
, T+ X& _. G4 G/ a, ], Llefttime=setInterval("scrollmarquee()",20). |. t! n8 j4 p. n4 [: ?
}# i5 D' V/ [' d& @
window.onload=populate2 l# J! z% E" W
4 p" _; {) c2 Y! ]9 j1 Vfunction scrollmarquee(){
% E# g: y; b$ b6 S Z/ Zif (iedom){/ s' p- K3 w4 ?! b' U6 b9 G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). H0 M: G. M$ F* w1 N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' }+ X: z$ o0 v5 D( s, Celse
' V+ C( N' F6 y# G1 N- ] jcross_marquee.style.left=marqueewidth+8
3 T5 j: O' l' n6 f- c6 s- k* T) d/ c3 J1 Z& e
}6 Z8 R) A0 M) S4 m( _
else if (document.layers){
- ^6 b5 Y$ @7 Z8 i9 Pif (ns_marquee.left>(actualwidth*(-1)+8))
/ P% l4 R. m; xns_marquee.left-=copyspeed
# `8 }) D4 _$ z6 j1 h' v/ Melse
2 m5 U0 f: \" [" `ns_marquee.left=marqueewidth+8
! z1 N3 J; ^' J; r}
. \, i2 i) H3 ~ S, R}
: r0 g* }$ x; J: b+ b+ V6 Y4 ~- R, t/ u
if (iedom||document.layers){
- A& o( j9 b9 J, U( N: W( Iwith (document){' Q. R" d) b& e8 |3 ?" C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ Q3 ^4 k! C6 W" K D) m: M3 _2 s+ K
if (iedom){4 Y; v5 P1 d" h0 @8 e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 m" b6 ]7 p5 \0 w) Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 d* o( I2 n8 o( B, H" T- ?. swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- Z: H# o4 D& Z+ T/ `$ H, Mwrite('</div>'): y) o8 [/ g1 Y( ]1 Z' R0 X
}
4 G- G" c+ e J6 D4 Jelse if (document.layers){
$ P" I7 d6 Z5 o9 X4 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): r5 Z$ N( R. H) X) }2 U/ X7 P& C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. a# ^ x! G! N0 ]write('</ilayer>')
# w, t8 T1 B9 ^}" D7 l" d: u, x" m i, c0 D; D& Z7 i
document.write('</td></table>')
& ] g" l& r1 r0 u% `# v% U}2 ?$ E# D8 B, Z1 u l
}; a0 n. Y9 Q$ p; K: g
</script> |
|