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

|
网页之跑马灯文字特效
//修改宽度
2 a4 F$ H0 V& P" @$ R% ivar marqueewidth=3009 q- E( @ I/ {8 T" ]9 N$ f$ D
//高度
0 h: d8 W4 X! y& x1 z5 g- b$ lvar marqueeheight=25/ e; {# K+ c# ?9 ^- S
//速度(1-10)0 r4 ~8 n/ G8 f: ]* T$ |
var marqueespeed=31 @+ P% P. [- T" G2 |: m# U
//背景颜色. ]. S" b: S) B
var marqueebgcolor="#FFFFFF"/ V5 f# t5 s2 k8 N" k5 G
//是否能暂停 (0=no. 1=yes)?
! k. X* |; l4 z1 U4 Q+ N: F. Uvar pauseit=18 Q" |* b3 y8 Q, Y9 H4 Y
( ^, s4 M- t& `0 _* K4 v: f. { b
//修改显示内容
# ^+ r8 m0 L( a, O8 K' _# q6 mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. V! B+ ]" G8 o& e- @3 f4 Q! q( p& Q: Y5 }* j1 ~6 X1 R
. ]) z& h) ?- S& \////下面不需改变////////////* o$ w% Z0 L7 N0 T9 {
6 g' z# W% b- Q9 [! Xvar copyspeed=marqueespeed/ ?/ r6 Z; w/ }8 }& n
var pausespeed=(pauseit==0)? copyspeed: 04 s1 U c. S a
var iedom=document.all||document.getElementById
; c3 g7 w( P& `8 k4 t( Q$ T; o8 h5 kif (iedom)
' ~( [: l# L9 d& J) b% t& j5 Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ y) w" z9 w$ c/ @' Jvar actualwidth=''
, O. k9 `' B& E) Rvar cross_marquee, ns_marquee
: H b8 f, G$ \- i, f& ^! q8 G8 o
function populate(){& ?( _" S8 n6 y" `; V% s
if (iedom){! Z1 g9 x n5 Q4 f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. a- s& w5 q& N4 _; v, \6 v, I- g- h) @
cross_marquee.style.left=marqueewidth+8) I, s- \# n( g3 N6 v* C
cross_marquee.innerHTML=marqueecontent
8 y( I: }5 E, m& `- b+ J9 Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 V1 i7 j0 v- F. Y}
" z& @8 p6 A. oelse if (document.layers){2 {* o" z1 G3 g# G: ]3 s) U
ns_marquee=document.ns_marquee.document.ns_marquee2
( a! K" ~$ q3 p7 a! G; E; {0 a2 vns_marquee.left=marqueewidth+8/ q2 e- W! k7 |7 z/ A6 E: `) l
ns_marquee.document.write(marqueecontent)9 l% }1 [) Q9 {8 Y5 h& _! S0 M
ns_marquee.document.close()3 e: y) a3 Q3 N# F5 X3 ~+ {
actualwidth=ns_marquee.document.width/ s6 m( H- k/ t. l M( v ^
}
- T1 d: w9 g# h w9 klefttime=setInterval("scrollmarquee()",20)
* M; F8 d. h ~; P. Y1 I% {}- i' e8 M4 [$ d; d0 E/ F
window.onload=populate) O; ?: |6 U# O, t
' ^, \; O: ~0 w, Z& }7 xfunction scrollmarquee(){$ }& J7 W" r6 o. f& x) V
if (iedom){+ O1 y8 z# z% X; h+ T4 ]" F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 l1 U& z# ^! @* _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* O- L$ q' k) ` Gelse
+ O& J1 Y+ n6 E+ mcross_marquee.style.left=marqueewidth+8
/ \9 A% W8 l9 a6 C: g4 k" S6 g2 w' R' Y* ~- S8 e- V& X
}
5 e' a1 q, G) S) Q) Celse if (document.layers){
# U5 m) [' }9 {. ?2 i2 l6 ?6 @ nif (ns_marquee.left>(actualwidth*(-1)+8))
- \& c8 _+ }/ c i# a+ y! d1 m* F3 n5 kns_marquee.left-=copyspeed
3 F7 v" G `* ^. _ T$ ~ ]else/ a' o0 Q# B9 S! p7 u4 y
ns_marquee.left=marqueewidth+8. `2 [( r5 b, w, W9 ?- I
}# O2 D' w3 ~) ]/ @2 r* h+ Y5 z
}9 V9 L0 n/ z3 u( I3 i( n i
+ g5 ]% N9 e1 K. m1 L+ m
if (iedom||document.layers){; r; g- t3 c- u; }, U; x( V' h
with (document){4 s& \8 e8 K, C8 {, o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# u5 z) ] B* _: u3 y/ w. [8 A
if (iedom){
& J/ R/ B+ s# n0 I: Q8 U9 \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ H5 Q5 |* L7 x) z3 l8 {8 O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" n- }- {8 |: T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); T; f! g: A; c! J8 q4 y
write('</div>')9 h$ H: ~$ U: ]9 s) x
}& F6 B, O' u* d# G: m3 e+ N
else if (document.layers){3 G$ v W/ A( y6 }9 u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 n2 |9 q$ j% n7 Q3 O+ @# P$ ~ \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): L; p( x1 R/ j$ u* Q
write('</ilayer>')4 P) y& s ^' m& C9 ^
}
4 i$ }, b" G9 C4 }+ Qdocument.write('</td></table>')
, B6 i2 ]' ?) G$ L7 f: z6 t}0 k# [% B" E. f# Z( `: v' o
}
9 Q- K4 W: ?6 j+ L! \9 G</script> |
|