返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 _8 ?, n8 I8 T/ o+ U! k9 V* _var marqueewidth=300
  |0 G! U; I+ Z3 M' V4 Y# }2 m, W//高度
' H1 x4 O( Z$ j9 n/ jvar marqueeheight=25& J& x: O" E% k, F
//速度(1-10)
$ R7 w, B! V9 i" H8 y( f3 x! {var marqueespeed=3
( _* S1 d4 Y( E+ v9 S* F//背景颜色* u; {# m& [  P4 D" p* `, o
var marqueebgcolor="#FFFFFF"9 _7 r' X# C9 M6 `# R1 K3 t2 E
//是否能暂停 (0=no. 1=yes)?- {5 H& M% N* f
var pauseit=15 j/ e+ Y" v( f/ u3 z1 z
/ t6 K4 {8 Z% `4 T5 T
//修改显示内容2 i& K# |, ~, u3 F$ b$ ~1 D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' N; R+ v" N4 o2 C+ |/ s5 _

: u4 z$ f" h1 S5 n5 P) {# V. s; Q: H; K+ U
////下面不需改变////////////( K+ |* P% V# a1 V2 B' ~
6 {1 m/ ?8 @- }& n
var copyspeed=marqueespeed
) Y8 z8 {& u  i! Q+ S+ ]var pausespeed=(pauseit==0)? copyspeed: 00 p6 J. Z  ^+ k
var iedom=document.all||document.getElementById
+ z8 l1 x9 o) V4 o  h- nif (iedom)5 d& Z9 ?- g7 P1 x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ h3 b% H% C2 [5 e
var actualwidth=''+ |  e) ]7 {% w1 n* d# w* V
var cross_marquee, ns_marquee; J7 u/ t4 b. K/ W0 M2 b

. U! R2 M8 j' S5 `- ^5 d  o- hfunction populate(){
3 [4 y, J9 Q% }) yif (iedom){
4 `8 R" A6 x2 e/ _7 Y5 Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- j- T- y, V5 W. v& P6 v! T
cross_marquee.style.left=marqueewidth+8: y  X; c. P  u1 T
cross_marquee.innerHTML=marqueecontent
6 _* I- N! u8 x; mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( e# r, l4 U. G& `1 }
}: ]* [) G7 D7 e) K9 O( I! a
else if (document.layers){
( V' ^7 O6 l& f3 F2 X$ b; y  C; Ans_marquee=document.ns_marquee.document.ns_marquee2
* X0 \, a: c" M' [ns_marquee.left=marqueewidth+8
1 N, L8 y8 R% e: h! H# cns_marquee.document.write(marqueecontent)
$ @* v1 H# {/ ~3 v1 |ns_marquee.document.close()5 L; H3 J8 Y7 D4 A; V& g0 n5 `
actualwidth=ns_marquee.document.width7 [0 B, Y  |& W9 @8 C1 i
}
+ t4 c% F& ?* Y) n/ d! `lefttime=setInterval("scrollmarquee()",20)6 q) S, M3 l- ^
}
* h* Q" X. @# ]7 l' ]# |5 r+ i& Qwindow.onload=populate* \" G- o8 x5 k, s

/ t/ Q! S" b# a* f# K8 Lfunction scrollmarquee(){
3 x5 W' o1 A6 c4 x( N: D! Oif (iedom){
9 U1 p  n% ?( u2 r7 p$ |. A2 Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 T( K! ?( ~- S4 j; }" e* d; M2 ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ B5 s; G# [5 `" Delse: m- w9 i' y7 C4 [2 ]% h9 J+ q
cross_marquee.style.left=marqueewidth+8
, z8 I+ n3 M' L: U+ k; h
. O! z" i, M; f" [! [% _; Y}8 m; o% e4 A/ s3 p% R
else if (document.layers){
  B( U' l' v0 u, y7 ~: d9 n- ]if (ns_marquee.left>(actualwidth*(-1)+8))+ ~0 h+ e( b7 J% k5 J; T
ns_marquee.left-=copyspeed; b9 s$ ]$ @% w* I
else
: h8 Q8 P3 u7 [+ p( `2 y* Xns_marquee.left=marqueewidth+82 h& I4 p* z$ S$ \2 {* E
}2 c% x; J: e! K0 o
}' u9 R9 o. B& ?8 L! |* N

) a" R4 R- Z/ j. xif (iedom||document.layers){
, F7 o4 w& G1 b8 dwith (document){* r* x0 `% P3 f! C! `# O) S6 {) {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): }% I4 L& s* ~: w) U' [
if (iedom){) U9 p9 k, H1 E8 i. z4 B/ F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, c( }/ G# K' a9 _) e$ M1 ^. zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# v/ K" S. S  D* N+ d9 d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" C# c2 o: [0 k& m  U9 _write('</div>')" }" h& _( i  `8 j! r6 O6 d9 W
}* `% n+ @4 K9 I. r4 z" B5 l2 T
else if (document.layers){
* h$ [4 y, g4 c) o+ b1 xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), W+ i. {4 P. g% [% ^& l3 P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ T  \0 I! z( |; |/ H" ~4 zwrite('</ilayer>')$ u1 O8 U$ p) I( @) l! |- W& i. {
}! T& f: [8 O: B# T& r6 K7 `
document.write('</td></table>'): d- B9 A+ ^, u8 ^( C
}# Q$ T/ y6 o  k1 {6 p7 y) u
}% |0 |/ F, B) J7 z- k
</script>

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