返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 d9 l7 c2 Z1 M% xvar marqueewidth=300
/ x/ {- h" w5 m//高度
; [+ h$ x2 k6 J- L7 W$ [var marqueeheight=25) ^0 k5 }  L8 j6 t9 S
//速度(1-10)
$ `/ ~* i7 Y+ Ovar marqueespeed=3* _/ X# \2 G2 z; O1 a& C
//背景颜色" I  q& S1 `: g1 Y+ ?
var marqueebgcolor="#FFFFFF"
% w# L5 E3 i# ^//是否能暂停 (0=no. 1=yes)?. a6 I5 O5 T$ B- W( G
var pauseit=1
- h- C# M' T7 V4 J' y- _3 k$ {( V  h' G, Z* H
//修改显示内容5 r7 g1 i) T, J) `% p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% g% u7 e. @/ B, o4 p
9 N, V0 m3 o6 O0 @

& g9 T; \. U3 Y3 O) `0 b////下面不需改变////////////
- j3 |6 Y7 h% }  L( S2 m* a( \) C% ^9 k! e
var copyspeed=marqueespeed
+ ^/ o% a8 E; P* nvar pausespeed=(pauseit==0)? copyspeed: 0
1 r3 h) n$ C) K# O( ^# B, zvar iedom=document.all||document.getElementById/ B. @6 l* R1 N7 Q
if (iedom)' A0 z6 r+ U( z1 r" s5 e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 ^/ o. R/ d' V8 t6 ~/ M
var actualwidth=''
& B$ p3 W% @6 F$ p2 d5 _$ Svar cross_marquee, ns_marquee
9 A; t) u, m& B; e
3 j. @8 @; Y( Y, ^. d2 H( N8 ifunction populate(){
7 g( H# s  A, F. ^if (iedom){# H% ^- R, ~) X+ P2 o! q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; I2 R3 z. U& s6 ecross_marquee.style.left=marqueewidth+8  T* w/ F% E) u
cross_marquee.innerHTML=marqueecontent
) B9 S3 S. n( Z# n4 g3 Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 t  i: X, r5 D
}4 S3 }' s; v- F5 F5 \+ }) H0 ?/ `
else if (document.layers){  G# ^" y% |/ ~) e( ~7 w9 I% W
ns_marquee=document.ns_marquee.document.ns_marquee2
# S  {, c; C# A  N% J, L  uns_marquee.left=marqueewidth+8
9 o* ?7 m2 X* I! z' Qns_marquee.document.write(marqueecontent)3 ?6 b& B2 P- F; l1 J7 O
ns_marquee.document.close()  e1 J" K3 ?. E, ?
actualwidth=ns_marquee.document.width# \& R/ ~. h" P1 [8 J: e% S1 ^4 Z
}% G, v' Y- P6 Z. ~- P* H
lefttime=setInterval("scrollmarquee()",20)
* D4 \( \2 [1 Q- f' c}
# n- N) o/ b6 [' R1 V9 `window.onload=populate
" `8 v5 f$ F( j6 K7 E4 Z" |0 k" A+ ?3 Q$ g
function scrollmarquee(){
6 c+ ]9 n* O/ `. Z4 a0 wif (iedom){+ E) p' F& |; W$ r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 n# {! X; {2 {& v/ J2 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: P! l0 @$ b& k9 F  Y& Uelse
3 `  f6 d* m7 a5 [/ \cross_marquee.style.left=marqueewidth+89 y9 v! [: {5 q7 I; ?6 g+ ^

8 Z8 L  N( A0 p: n}8 o# z( X5 K. \# j, Z) t$ w
else if (document.layers){
( ?7 ~5 t3 K+ b& D$ V* O# e( Zif (ns_marquee.left>(actualwidth*(-1)+8))
4 g8 D3 l1 ?  \: ~! Sns_marquee.left-=copyspeed& b' `' P# Y5 X' g7 ~  ~) Q
else. U- n# i5 q8 Y3 N* V$ i# K7 ]
ns_marquee.left=marqueewidth+81 g' @. m2 [( n$ r
}) k2 b: I4 V0 X" w6 b0 O
}, |1 l0 }( Z1 n  h( T# R; r5 v0 m+ m
9 {- y' E* P8 }3 o9 _4 h- ?$ Z; Z" z
if (iedom||document.layers){
; x2 b5 G- s- o" H, M1 swith (document){# G/ r2 ]! Q) ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: {: G( ~& _% D' [4 G2 q  _if (iedom){& O  w3 H9 w; M3 s. Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% e: h/ G$ P: Z; I+ B" v0 Z' N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 a1 B, K* ^( A: @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" I+ d. V# }2 m* R; Twrite('</div>')
( j! L, o! t, Q1 ?% j}
" Q2 B2 x8 g3 Helse if (document.layers){/ b; i# M/ }5 p1 R( n; c8 W0 Z# M# C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 c' n+ Y) n( E, J  `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); H# _" l- A* p0 z& M5 q- T
write('</ilayer>')
/ f6 c5 I2 `* ]+ A}
) {; _4 Q0 l9 Z, f# n4 Odocument.write('</td></table>')
/ O# ?& A9 L1 k( d+ u}8 [. {/ }& j' T  [1 ?
}$ T2 n! S# r5 d1 R0 l% w$ n( S0 ~
</script>

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