返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ U+ }* Z; K# C, W! Nvar marqueewidth=3008 Q$ {& |2 `2 T
//高度, ?" N/ z6 F2 R) K" m
var marqueeheight=25
# W( [- w0 ]! o" Z' k8 K//速度(1-10)
+ c  V/ }/ \! U3 \2 tvar marqueespeed=3
% r. @% b, Y% e1 A! ^- M  a//背景颜色/ N+ X$ ?, h0 d7 |% v6 h% z# O- C% |
var marqueebgcolor="#FFFFFF"& M2 s9 r& g3 I/ D# i
//是否能暂停 (0=no. 1=yes)?
5 w5 T* j$ X& j5 nvar pauseit=1- S1 M% ]3 B3 U) T7 d: D: V

# A. A  ?, ]. n, k//修改显示内容% q2 k5 |0 m7 J2 \# Z9 ?7 c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': n/ y, f: q! R8 B  C- t+ B

2 W! D9 v0 D( w5 a, P. m$ P1 \: n( Z+ Z9 l! ]  ]- O, a9 l
////下面不需改变////////////
  O; y. w6 g0 d: A6 W# {" g" @" }' w, q% D  @$ S
var copyspeed=marqueespeed* n" Y# i8 M; w3 [, ^1 P9 Y
var pausespeed=(pauseit==0)? copyspeed: 0" o/ Z/ _3 Z9 \& ?( B5 t
var iedom=document.all||document.getElementById2 w" h) L- i9 W& m! H1 s) @8 C
if (iedom)5 r/ J, F$ E/ C# Q9 U; n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), |$ ~6 H1 m# W9 I9 t$ B0 t% x1 D
var actualwidth=''
9 m  C. R% w- n4 _var cross_marquee, ns_marquee0 n5 f. U9 Z8 N
+ F6 n1 f, G5 C' H7 Q# o
function populate(){/ H* ]- ]; ]) v* c2 E
if (iedom){
- w4 }, a$ Z/ B2 k2 x* lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, \- R7 f& J- G% k4 Dcross_marquee.style.left=marqueewidth+8; t3 o0 M8 ~9 P- a
cross_marquee.innerHTML=marqueecontent
/ Q  q& Y. q4 Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# Q% |% s/ m6 P* E
}0 s1 A$ i/ p- g9 I) O
else if (document.layers){
; v0 ]5 F+ \/ I5 n1 a2 [ns_marquee=document.ns_marquee.document.ns_marquee2
+ o) `5 G8 J/ t( I% uns_marquee.left=marqueewidth+8: }. l) z- W6 ?3 ^
ns_marquee.document.write(marqueecontent)  q% ~2 q# f/ y8 H0 k6 P
ns_marquee.document.close()1 e0 ]& e. a! S
actualwidth=ns_marquee.document.width( d8 u! P& H! V' R$ `
}
& e% h* c4 j3 S- [- Y' llefttime=setInterval("scrollmarquee()",20)
0 E$ u+ L) R0 `+ s# ?8 S: k}4 |8 W6 N( S$ t2 }; k
window.onload=populate
; y0 D# E3 D, @1 ^
# C4 e+ L" e" @% n$ a1 J6 z4 vfunction scrollmarquee(){
1 A; i# o6 t) |( }if (iedom){
+ ], d! L* J3 P( l8 ]; oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 H' q6 e( W8 V, E3 Y( ]7 p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ {. \0 b1 I7 i8 G, telse+ f- ~0 @, S: y+ ~$ _8 E. ~+ q/ m. J
cross_marquee.style.left=marqueewidth+8  h6 T7 q( n) @2 z! t

4 _8 |% n+ H6 U& L# b}' n, B9 p! s& Q4 b$ j
else if (document.layers){4 z! ]) }% w/ u+ V; b2 W4 g
if (ns_marquee.left>(actualwidth*(-1)+8))
" k! n3 s: [* B! wns_marquee.left-=copyspeed  w9 P: X2 S, y+ R
else; ^2 Y$ r+ L) T9 P5 ]! n
ns_marquee.left=marqueewidth+83 R. e8 U( P% h7 f4 [- X
}
% Z8 _9 D" j; L}9 }  I8 P9 O, F: W( N2 f

3 t. P5 q5 G* X3 W0 e0 `if (iedom||document.layers){5 f- w0 ]/ U, X
with (document){' V6 B" ~5 |! N- k, U4 G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* u) b4 ~; H; L; [9 Y) H
if (iedom){
9 _0 Q8 t7 G3 B6 Z; a1 _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 B# ]$ z' C7 Z' s: J. f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  Q2 J% ?2 B0 u1 ]' P5 Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, u- L7 j$ t) Y' @8 K# Iwrite('</div>')5 l% _9 X! n& w, Z
}7 k& m+ _+ \# L/ g0 ]
else if (document.layers){, z# S5 n1 M; y% U2 A# @# j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 q4 M% v2 D9 s, Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! N* E4 z5 B# V" d1 y0 i8 Gwrite('</ilayer>')
  ?! v1 ?" G3 P$ f/ X! ]  z}
4 s; I$ k, H+ d+ cdocument.write('</td></table>')
5 u' L1 \) ?( ~& y% }}
: Q5 W* r* \6 K! j- J0 g}
$ u' Q! M8 d6 w7 Z& C2 c</script>

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