返回列表 发帖

网页之跑马灯文字特效

//修改宽度" }& s- R; n: G) L- W" d+ n
var marqueewidth=300! ]; Q2 L. f, }1 |
//高度
+ Y& Z. J4 A, Nvar marqueeheight=25( \  B% d) V1 @# O# Z& b& y
//速度(1-10)
# A$ \' ?  C, H0 _6 Nvar marqueespeed=3
8 Z- i$ e5 K+ \: P& X//背景颜色
1 u; ?2 G$ @6 f5 x7 ^1 Ovar marqueebgcolor="#FFFFFF"* B7 @8 e: Q0 L
//是否能暂停 (0=no. 1=yes)?
2 P) ~1 q- m+ Y2 e4 hvar pauseit=1" Y# {$ u4 `* i/ m+ c3 I# N

9 W  @4 c* y8 W7 n//修改显示内容
0 `* \8 ?0 ^$ g2 g) p( Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', k5 u+ O' H2 x& ~2 o+ j( ^3 A2 _

4 T* _, e* ]0 h9 G7 r( G' s# Z4 V6 U, \/ b+ l: V2 f/ t0 s
////下面不需改变////////////
3 A) v+ g  h' z5 n2 ?- B  [1 S; a6 o& F4 A1 l0 A
var copyspeed=marqueespeed" W/ T" h6 ?, h9 ?- d
var pausespeed=(pauseit==0)? copyspeed: 0' E. f. D5 C# K% s" D
var iedom=document.all||document.getElementById% x- q% W8 B0 n3 j/ \7 q: [
if (iedom)
6 @$ |+ r0 I5 @) D  J6 jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) l) Z! D, n/ q
var actualwidth=''
9 ]* ]: w( a0 ~) x+ ~var cross_marquee, ns_marquee# N: F4 H% `0 D" U$ f: W
# @* F# t3 K/ b4 u) [5 p
function populate(){
6 j% R- u2 @* x7 ^) `% f, ?4 Hif (iedom){; L: r. n- A- b4 D. {: L7 F) U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) U4 `$ h! p5 N5 S- K: ccross_marquee.style.left=marqueewidth+8
- \0 g/ W8 j6 o' b# s3 d& z+ P/ u  Rcross_marquee.innerHTML=marqueecontent, K" A  ?4 S$ A. C' t1 W8 O" S9 j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* w6 M; G( i9 V; Q7 ]4 O% R
}
- |4 w9 ?' p6 J1 Kelse if (document.layers){
% L& ^* S- l+ A* p! Ons_marquee=document.ns_marquee.document.ns_marquee2
3 }+ t4 C6 ]2 B! {/ xns_marquee.left=marqueewidth+86 K: z4 h( T1 v  j, \4 r% _2 W
ns_marquee.document.write(marqueecontent)* B! l  H6 j( {$ D7 ~
ns_marquee.document.close()- [- |! X5 \' m/ ?  {
actualwidth=ns_marquee.document.width
( h6 f1 t$ o+ z- }/ F  O9 i}
1 r* K# v2 P/ olefttime=setInterval("scrollmarquee()",20): ?. ]+ U' B: j
}
  ]" p1 V" u7 G) R1 Pwindow.onload=populate; |( z' V8 f3 O2 G# ?6 ?

  ]9 z, E8 Q, C7 Qfunction scrollmarquee(){- ~) @/ X2 W' W6 p% j4 k( O) X
if (iedom){
/ X, g+ Y0 h6 D9 nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' s0 R2 O* u' K, u; Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: Y" A  }1 h5 f2 \3 |8 X" F7 t# m
else  l% {' T+ u' C% R0 b
cross_marquee.style.left=marqueewidth+8) |7 H0 q( {3 p$ W; C
! E, I* Y' Q' m% q# w/ L- \5 e- ~2 k
}
4 `% C, j  M- W" T& `: ]+ eelse if (document.layers){
6 o$ o6 D8 m) ]; R9 A" _. Xif (ns_marquee.left>(actualwidth*(-1)+8))
: d4 x6 s3 v. rns_marquee.left-=copyspeed% B6 l! X4 M  {9 _' U
else* f, v# A/ y. @. Q7 [
ns_marquee.left=marqueewidth+8
) o5 f( ]! e6 |' e" a}3 w3 j& }# C1 }% ~+ S) T3 n$ B8 F
}
  d* |/ r, k3 J0 w: H5 C- v& C# j3 P/ ~
if (iedom||document.layers){
0 e6 p/ G" P. W7 Lwith (document){3 y; G6 `* Z$ P. ?  J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 k( E8 l$ S1 L$ ~
if (iedom){
# U4 m% q3 u2 twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% Y1 {! a! R' J) U1 U+ u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! E6 N; p8 u; J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 c( G2 _3 n5 s/ i* s/ m. Awrite('</div>')
* q: a* u  X" e/ m$ a}
& |% K8 Q0 u) r3 t! M- z: @else if (document.layers){- U5 J, h( Z% m4 n! N* m) p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* ]' A; ^) B) r3 O) Z* @3 G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 \' D4 T" d4 S' G0 J/ G
write('</ilayer>')5 m5 o# X' Q/ V8 F$ W1 k4 j
}) `( X: q/ u+ M1 R9 ~
document.write('</td></table>')) I  X! q2 d. I9 l4 [4 x9 z
}
2 V8 `0 A3 K$ o  x7 @}
0 n" s5 u; `( m( R</script>

返回列表
【捌玖网络】已经运行: