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

|
网页之跑马灯文字特效
//修改宽度
- M/ v- J: V. [$ s' m% H3 dvar marqueewidth=300
! t; A3 w5 {0 O' N( @+ y/ }# U I7 m//高度
; H, u6 T: G) s+ F" Cvar marqueeheight=251 ^: y }1 w% I% l/ f5 e4 q( w
//速度(1-10)5 n; T f" W9 v0 J/ v4 M7 R
var marqueespeed=3' \( f$ ~, ~' _$ _
//背景颜色. \: u3 C+ ^( H+ S" C
var marqueebgcolor="#FFFFFF"$ ~. l6 Q% B4 S( J: X L: T A& a
//是否能暂停 (0=no. 1=yes)?
5 N$ T Q/ `! lvar pauseit=1
( ]* r# j& C; L! {8 @% N: e' q& j, S3 }) E* {
//修改显示内容
4 M! K/ s5 Q8 ^6 Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 u$ f/ _6 @7 u2 P* L
1 m7 S* h3 ^* B2 C
) D8 K; R- ]6 H7 S////下面不需改变////////////) B' G8 d! e; q% h
( B& b$ b4 u* Q! K* i
var copyspeed=marqueespeed
# u @* K! n- Y* Kvar pausespeed=(pauseit==0)? copyspeed: 0# A3 J, c9 n' {- m6 x
var iedom=document.all||document.getElementById0 _# F5 d! p! D8 T7 D2 U
if (iedom)
3 N( f+ [5 L$ R8 d( E5 X7 Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) k! {( s( h2 F3 j. [8 F! f5 Wvar actualwidth=''% e. j* U0 P: M% Q x
var cross_marquee, ns_marquee6 B) t P6 J' L
% _. U. W$ M: m) z8 gfunction populate(){
+ a* i* d9 ^* M. }# ], v1 y: Qif (iedom){
4 f; N2 X! H L! ^ `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ m9 M6 l5 Y) ?. zcross_marquee.style.left=marqueewidth+8
4 o' ]8 y# g; E0 i* q+ Rcross_marquee.innerHTML=marqueecontent
% o! `, J% H2 l) t5 K% v8 d0 }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 k R( u, Y3 J6 i2 V, i9 Y$ q}/ b' f$ ?8 J- K5 D3 P/ v
else if (document.layers){
7 I% e. p) {0 C( c x5 A8 uns_marquee=document.ns_marquee.document.ns_marquee2
8 w, K% J3 F% g# ^6 |ns_marquee.left=marqueewidth+8
5 G: o9 _% s: d' o* p" o }& s/ a" mns_marquee.document.write(marqueecontent)7 o6 x; T7 Z8 k. Q. V3 K* Q8 a0 _4 z
ns_marquee.document.close()
; k' R, H, ]! I' Z: aactualwidth=ns_marquee.document.width; [6 P) F' ?4 \! \8 _
}
) u: M9 F* x. @2 Alefttime=setInterval("scrollmarquee()",20)
4 Z7 B% {1 O9 D) n0 X) W}
& ~$ h$ {9 {( n5 ^' S, bwindow.onload=populate
?- u4 U) p2 {( ^0 T- y1 M. n# \. H. P5 E! Z
function scrollmarquee(){
( r/ Y! @- G% D, J: z+ g' gif (iedom){
j. a4 k0 _2 l6 H: kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' W4 o. k( y# k5 H2 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 N @: T: w" Z0 _0 c, Yelse8 Q1 I& F9 o* y6 O9 g% d0 z8 S
cross_marquee.style.left=marqueewidth+83 F: F# z0 P( J: ~6 f" D
- f8 d Y9 m' C- a, p" k0 e, b}
: u8 B" s. q7 f3 P! @/ ?else if (document.layers){9 m+ t- f. ~" i1 z
if (ns_marquee.left>(actualwidth*(-1)+8))
f! Y Q: d% N( g3 Rns_marquee.left-=copyspeed( q- _% l4 d) S" b
else2 D( {; |; G9 {
ns_marquee.left=marqueewidth+8, r- G, k* q( {( Z
}
0 V" x( j% c# D2 x# }}% p7 b$ w0 }9 q
7 J) T" F+ h1 V
if (iedom||document.layers){
. q8 `% ?. t& {' F& wwith (document){
. |' P" J: q/ @: V zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% F _' h) F4 _6 C
if (iedom){
) W; R/ t: I% `% W2 X6 Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 U0 h7 l8 I9 ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 \ V3 `! Q! |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 h1 j! t; z: C, D b
write('</div>') V( r% h4 d. U! @, P' Y$ d
}
0 ~8 K6 @1 i9 l4 q1 ielse if (document.layers){
/ k9 z( j( E2 _( l8 }8 Q* @! E/ w' kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): n g3 n8 B, M! e7 V9 w, I Q& Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 H* P. Q2 m4 A- O0 ^write('</ilayer>')
+ r, W' L4 |, L, a5 a; j}0 T0 V$ m8 k f: }9 H
document.write('</td></table>'); w( Z$ d2 O6 y, P% h' D7 A
}- T/ L: W- {# i1 e4 r) Q% I
}( I; q% c5 p' N" p- r( l
</script> |
|