返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ X2 E" ~  c5 {- A* \7 U: A0 Q2 pvar marqueewidth=300; A; X- U$ N- i4 j
//高度
9 F& ^5 s) c+ q% [7 Rvar marqueeheight=25
$ K" G5 X+ j# j; K2 m//速度(1-10)% {: a7 S2 M8 y
var marqueespeed=3# n6 X- R1 d3 n
//背景颜色
! [% Z3 @! O) Q0 b0 |# E# _- @var marqueebgcolor="#FFFFFF"
# A+ e1 v0 _8 f1 B. j6 h//是否能暂停 (0=no. 1=yes)?! g+ F1 i: K1 o* Z& ?3 ^' p1 t8 C
var pauseit=1: C$ u# Q2 K4 R7 w. _" |
: N% `% s3 {8 Q# V' w/ S6 h
//修改显示内容
# \6 t- b! z' e3 E( w: {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 E7 \7 [5 c2 A" M/ O6 L, r, c$ G
* y4 E: A; V9 C3 i
- z* X2 V9 X/ s& Q
////下面不需改变////////////% O3 z$ \. N3 f
1 n4 A8 k  ?0 k4 @; T
var copyspeed=marqueespeed
6 \1 S: B5 f  j# m+ E$ W* h8 kvar pausespeed=(pauseit==0)? copyspeed: 0
' ^: n& m  x& \  _0 ?var iedom=document.all||document.getElementById" F0 w# }: d9 g2 l6 g% w2 c2 h! A4 L
if (iedom)
9 T- g4 u' T7 C$ R; k. @/ Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* z. e2 v6 a0 l" dvar actualwidth=''' D6 F$ L1 F3 V& e+ m
var cross_marquee, ns_marquee
, Z5 _: t( S5 G! k. ]) W) Y; {' D6 A/ m# _- t
function populate(){
! Y, f' W' b. D3 D6 lif (iedom){5 @  E2 v/ `2 s4 r; N, o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 l% J6 y' i; M5 b* ]3 xcross_marquee.style.left=marqueewidth+8
5 [+ B. ?3 w9 x- W2 ncross_marquee.innerHTML=marqueecontent& [6 H6 R- k" J- u5 x2 O! h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ F1 y* |" e+ N/ b1 H, V
}, O6 d, h3 K; G0 x: m
else if (document.layers){) e( X( K& I) J4 e" J% j1 f# [
ns_marquee=document.ns_marquee.document.ns_marquee22 g# X2 M) k* [
ns_marquee.left=marqueewidth+8
) [7 P. Y1 I" xns_marquee.document.write(marqueecontent)
6 ^' j. P( N, ?/ J; N9 J. I8 w; nns_marquee.document.close()
5 g( u2 J2 R' R# L- F1 A# C" Aactualwidth=ns_marquee.document.width* h' L* H. h, |1 H8 Q
}
, T# ^4 ^# f- I! v% P0 alefttime=setInterval("scrollmarquee()",20)* j! S* U' R" P8 g) X0 V6 z' M
}8 E" I, t& [7 X, S
window.onload=populate" t4 h' q7 c2 R8 B: y

* S" h  a2 `0 |" _9 Qfunction scrollmarquee(){
* Y. N+ c) |0 ?2 Zif (iedom){5 N2 z- _: c7 q3 k3 H9 E+ w2 X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): H9 G' W; C7 a2 {0 V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 Z' g/ l, E6 S5 Relse
9 ^) M/ e5 t8 R" }3 ecross_marquee.style.left=marqueewidth+82 G  H2 ?* m$ v, W+ e  n

5 X% Q( O5 i1 k0 `# R6 P  }}
, W$ _+ ~9 ~- O% Q. k; _/ X# s+ j/ Zelse if (document.layers){
% X# D; |, X1 \$ [) `if (ns_marquee.left>(actualwidth*(-1)+8))* L1 ~) y; n8 `7 g3 N3 U
ns_marquee.left-=copyspeed7 e0 N8 @1 w( j3 z: x4 ]
else" e; F1 T3 i, D* c3 J% Q
ns_marquee.left=marqueewidth+82 I9 l4 {5 u9 B- n2 l
}7 F0 f3 A- k+ o5 C( ?$ }3 ^
}8 ^" K) c( z/ {6 L' Z  o
8 K- k) g, r# A# C* ?% O6 c' ?8 [
if (iedom||document.layers){& Z8 y! G; N# C; ]
with (document){
- H4 J4 d* y8 l$ Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' [; G' D9 x0 l$ X9 ~1 ~if (iedom){
! m# ?/ o& l/ @+ f; M  A" pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 C: g1 U0 g2 R, S3 W, ^" F+ J. V# e: M6 z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 p% [5 b/ T: c2 S' R* }6 _9 b/ \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! O% n* ?& g" S& {write('</div>')
* ~# a9 ^' ~8 x" E7 ?; z( z1 Q$ R. ?}* j: E& h" {" t- u; N+ P, p* L- ~
else if (document.layers){
7 Q3 R0 I# i( H( Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) ?/ b; G0 S  g' v1 I' hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) i# O8 n& i8 j& f% I# C) g: i! M& l
write('</ilayer>')* f% D, _/ P8 e. g9 v+ [
}
) S: T2 b  v# S" Z( p$ g+ u. Hdocument.write('</td></table>'): H& ?/ ?# V" Z  _& S. d
}& ]0 P# M4 u9 t4 B2 }  G# y) p2 K) [9 n
}( V9 K' g. x* {: H& i3 A
</script>

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