返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 f2 {# |& @7 h6 p% U) F0 ?  |var marqueewidth=300% H0 c0 @( W" b0 T" r
//高度
5 Y4 Y/ {9 N* ~- l3 Ivar marqueeheight=251 x* P1 d9 n6 D) F
//速度(1-10)& b/ ?1 \4 o: h) L8 i% v% ^+ B4 \
var marqueespeed=3" O& M, F/ O3 W* O" }, G% P
//背景颜色2 A& C) J5 o' U0 T
var marqueebgcolor="#FFFFFF"
9 o$ [+ \2 P& }: ^. U  h, p7 v- N//是否能暂停 (0=no. 1=yes)?& E5 _1 y8 C# {
var pauseit=1
! ^5 z, ~: a  s
- c; V  J7 d$ d  \/ B6 O7 R//修改显示内容0 ?  k( T9 L% k$ P8 m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( ~& ]) l7 T% O& m# P
' E! |: w. H" R% v
5 c9 z9 g0 u, o1 J7 Y////下面不需改变////////////
/ T9 U: P" c8 H; `& x5 }* j1 k
/ |" V& Y& j9 f1 n+ P4 _) Xvar copyspeed=marqueespeed# y% }6 G7 y* C1 k
var pausespeed=(pauseit==0)? copyspeed: 0
6 l  I: z9 G- bvar iedom=document.all||document.getElementById# d( \/ g+ A1 b* P; ]$ g. n
if (iedom); M' ?1 ?6 H5 o/ F& R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 {& B( |3 H& U0 u6 O; [
var actualwidth=''3 F6 n$ v  Q- A# H" k, b) f( U
var cross_marquee, ns_marquee
/ |5 R7 T# W7 C6 M7 e& y" O4 N, b
function populate(){
$ B/ V5 l: O3 o( jif (iedom){/ \/ o9 z+ ?+ y& X5 A3 Q/ h" n3 l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ c/ A1 D) @3 h6 [, U$ o
cross_marquee.style.left=marqueewidth+8
% A) ?* L! r- O- z( H2 K9 Hcross_marquee.innerHTML=marqueecontent% ~& P! H0 C& o2 \# c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  A1 O& J6 L! ~8 c# O}8 _% D0 r& I! f
else if (document.layers){
- p- T8 x6 Z. z: B1 X9 i0 Nns_marquee=document.ns_marquee.document.ns_marquee27 M  W2 E. a% r' B. q
ns_marquee.left=marqueewidth+8+ D- Q& v) d' j( `5 F( [
ns_marquee.document.write(marqueecontent)5 z2 \/ C. u+ K4 Y
ns_marquee.document.close()
$ h3 p4 q( O1 E; R' U3 I! Factualwidth=ns_marquee.document.width  V) w8 o# ^0 ^9 E7 B! H' g
}2 Y* H7 h2 A" }, `
lefttime=setInterval("scrollmarquee()",20): R9 Y) b% |9 |# j9 d& K2 ]: U: n9 i
}, y/ H0 Q. A3 M+ a6 _7 f
window.onload=populate" [+ S% _9 H# v5 d$ i$ j

0 c  Y! o% y/ s7 i& s3 Yfunction scrollmarquee(){
' @0 x+ C% `; j7 F/ d+ \* P7 Fif (iedom){4 B. n3 h# r- c
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 P. J( Q% c0 R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( _* ^) J+ `/ B$ u7 Welse
# r% L8 m" F+ x  _cross_marquee.style.left=marqueewidth+8
4 G/ {( o" T# T% h
  N" W$ ]: @5 X: ?; H}
3 w+ D7 h. d9 B- Welse if (document.layers){
  y7 U( K9 ^" q4 X2 Dif (ns_marquee.left>(actualwidth*(-1)+8))) q/ W' e6 m* c, p
ns_marquee.left-=copyspeed
- G" A2 h  z  C; M2 x) k3 pelse- U2 Q+ M, Y6 u! @# _7 c
ns_marquee.left=marqueewidth+85 E- V4 [6 d: M! I1 ]
}
0 r) d: w/ ~$ ^& ?* I1 q}- E+ E3 I7 t9 O/ F! y4 R8 N' h
$ a0 q$ z3 x0 g2 U5 b7 p
if (iedom||document.layers){
0 U  g8 \* N+ K2 W9 K, ^with (document){5 i9 X6 s- u3 z! L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( i0 B2 h, k& A, S' ?/ X% \6 m( C6 P
if (iedom){
) o( I' y% e" ~( E; F/ `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 D6 o5 i7 {0 W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ i9 V/ Y8 F0 H. ]) Q3 j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) k7 F; I" |( M4 N+ b8 K
write('</div>')9 X6 {& v$ v: ~" p6 l$ M
}
+ i, ?. i. y  W) S/ S$ ?5 `else if (document.layers){. P- d# B0 q9 J/ M3 G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% B$ \* x# Z/ B7 swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ [! X4 ?; ~( a( E) a$ j" ?write('</ilayer>')7 Y" t0 L5 N) i$ l/ l* l: V1 @8 `0 G
}: P" B* B5 Z- Y# P6 o/ {
document.write('</td></table>')
2 [1 V7 C: H7 |/ D}2 p1 n# \; y+ q& d. w
}+ J7 y$ ~# T; {$ O* V/ ]* n
</script>

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