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

|
网页之跑马灯文字特效
//修改宽度8 O6 x9 M# W, |+ _
var marqueewidth=300
1 W1 k; L9 z6 y! ~. v//高度5 N# [7 C! J1 S7 w% C: P
var marqueeheight=25" k( [* U" n0 n+ W! p5 `5 c
//速度(1-10)4 N) o. q) V, y7 d3 j) [ q6 A
var marqueespeed=3
( A; n$ S; i4 D! C/ s//背景颜色
$ D* X% n1 A, }) vvar marqueebgcolor="#FFFFFF"
; U* j* H" d8 }: P% O* K//是否能暂停 (0=no. 1=yes)?! b" O0 q1 l! s
var pauseit=1$ X- b; N" n: K7 c1 _
5 N" {0 a! f+ c9 \1 U' I- u//修改显示内容
$ q- l4 O% [" N( A% I! z% Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- \: V9 `# J4 @# r& s8 u- S2 N* _, ~4 p' m
2 t8 v4 {% u0 ?8 J- ^////下面不需改变////////////
# R4 s. {9 F' T' h, c' S
9 K# L( a0 q0 R+ ^7 u& C4 kvar copyspeed=marqueespeed5 F6 w4 P9 N) h) j- [3 n+ T
var pausespeed=(pauseit==0)? copyspeed: 0
. T' M4 c+ `( @7 b& g8 c& fvar iedom=document.all||document.getElementById
: s0 y+ a2 ^ ^3 ]6 k( D* K! Fif (iedom)4 X. G' A) i2 Z, M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! l! w" r+ `% u4 y! lvar actualwidth=''5 h2 V) a9 @4 v* q2 z/ V% [' `# m& r
var cross_marquee, ns_marquee
9 I3 ~& J6 W, u* P
1 a q7 S" S. \function populate(){
4 q# n& F- i7 m, Q# F: v! Wif (iedom){
/ K% O- Q3 F% [3 k( U8 E2 R" b$ tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 ^) F% O* X7 A+ w" `cross_marquee.style.left=marqueewidth+8
8 f6 a* I6 J- a1 G# Wcross_marquee.innerHTML=marqueecontent9 C, d. K+ X5 ]9 n0 G4 O. `' C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 @7 I& U. e+ F6 e: ^5 t, i}
m( W4 q/ i9 B5 l/ ?4 m+ q# E9 z1 V) N4 ^else if (document.layers){1 {0 v# X/ \1 Y9 h" O
ns_marquee=document.ns_marquee.document.ns_marquee2" P" a' \6 {; I; S" Y3 ~6 i! G7 ^* I) O( F
ns_marquee.left=marqueewidth+84 t. V2 V' n+ }& [
ns_marquee.document.write(marqueecontent)# d8 |4 s& U8 f0 [" r
ns_marquee.document.close()
0 d; r3 c& u6 b- @# Y! ^) kactualwidth=ns_marquee.document.width
$ D1 j7 ]: C Z# \1 h% N}3 @! d* o& H3 c; c
lefttime=setInterval("scrollmarquee()",20)
" _! D v5 x) \4 \4 ~: h}
5 v* ~2 {- a/ U0 f7 Dwindow.onload=populate
, Q4 Z5 Z9 f/ L/ Y3 E6 r! u; h* m6 g1 [
function scrollmarquee(){7 ~# G* u, S5 ~4 o: X2 T0 `
if (iedom){: b5 z. G8 g6 b' i) @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
}# ~% h2 h. G5 b3 `% b, Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 T1 U( d" w7 w9 @ h3 f
else3 W. Q) Z/ J0 s( {# [, X! p/ L& x
cross_marquee.style.left=marqueewidth+81 B6 ^0 `$ T1 a2 w' j
3 `; T" x" C I
}) U8 k0 A. K* k9 ^+ C. z
else if (document.layers){5 d5 _2 K( d: K( ~8 X' [7 @! z
if (ns_marquee.left>(actualwidth*(-1)+8))
" W w3 i3 T- P- ans_marquee.left-=copyspeed& q1 |9 C+ T7 g" N' V0 c w
else6 q: Z7 T' u* a& A7 V9 q2 R
ns_marquee.left=marqueewidth+8
- z) z8 t1 Q# L; z, o6 s}
( u! v0 Y1 D) x+ X, S! h9 d}& v; O3 t( X- T* E8 }: z
+ m; C' K, `5 h7 q& _
if (iedom||document.layers){
) a C3 c! Y+ Z5 Cwith (document){: Y) p; h0 S) `( A2 M& `3 h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% L7 _ d6 P, W; I0 oif (iedom){2 A- _# o+ `0 n5 r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, m9 n& _1 l3 \/ i/ x% ?; S$ P" Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( _/ D) _% q: X, a6 O5 }4 A s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 j" O& h" k' d I- L- {
write('</div>')9 K3 E7 q! S& o" Y! P$ p
}! n7 t! o2 [( L/ g+ o
else if (document.layers){% u) s0 i6 N6 n. o* F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 z: R. ]& Q- u5 D8 X9 C1 m1 Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( @% c+ E! m; E( Qwrite('</ilayer>')4 o* a5 [1 {! i
}( K' x+ K* I8 Q
document.write('</td></table>'), {6 V' I; k; R8 u
}
' j9 o0 d. J2 v# L) Y% B}
7 s7 L! u& R& B1 T2 T5 U7 U/ z3 q& `1 q</script> |
|