返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 r2 R: P% T0 |0 _1 a2 V/ ?
var marqueewidth=300
1 J" l3 i. \  S7 _+ T7 l//高度
" X' m( j$ o$ O0 }0 ovar marqueeheight=25
6 G3 j3 w- f5 G% O//速度(1-10), s$ _0 C$ O! a3 k7 s
var marqueespeed=3! S3 l/ u+ a0 n6 r+ r
//背景颜色
. b( c3 |2 \' C, E6 k* rvar marqueebgcolor="#FFFFFF"
0 m" f7 f- C% k  K8 X( v/ `//是否能暂停 (0=no. 1=yes)?4 {3 J& w5 z6 Y) `5 e
var pauseit=1
; d, e; D) J# ?6 U
6 p2 Q$ j) H- O+ H+ Y7 g' j5 h//修改显示内容" ?* g, J2 o% i& A% v0 M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 G7 C8 @# ~, i& x9 p+ b/ ]  G1 Z( W5 a2 ?

4 O: [0 I, S; d////下面不需改变////////////
6 `' X5 o% ~/ I% i- P. C$ Q( @8 A1 Q' \( u2 S; s
var copyspeed=marqueespeed. ?* d; p5 X5 q4 D' p0 {- _
var pausespeed=(pauseit==0)? copyspeed: 0
' t" N* _/ {/ z; h4 `1 B1 p# pvar iedom=document.all||document.getElementById
; p+ t+ a% |1 u7 i$ I+ {* U: S. vif (iedom)
6 O  C; E) K1 [9 wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  P, c8 x& G) W6 f( X3 Q* {( bvar actualwidth=''1 d/ S) m3 m2 ^9 {  w. l, b
var cross_marquee, ns_marquee" X2 o& n) B+ Z7 U

$ g, T9 L" \; d' X. G% Qfunction populate(){
( E5 h2 ^3 c! b$ Q& z  _9 ]* kif (iedom){( n9 S" k) Z9 z; ~: F0 k4 G6 t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 J$ x! s. \/ ]% {7 Y8 k* Mcross_marquee.style.left=marqueewidth+8
+ U# @: }4 J' w+ Bcross_marquee.innerHTML=marqueecontent+ t! F  Q% [: V3 s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  z0 L! C) b2 ^, v
}  x+ F  ~3 o) p2 h. E; s
else if (document.layers){
7 w; K  H6 d* L' d6 L: x9 bns_marquee=document.ns_marquee.document.ns_marquee23 Z1 y7 p5 L0 t$ ~3 R/ P
ns_marquee.left=marqueewidth+8
4 V* v% w0 l; Dns_marquee.document.write(marqueecontent)& P. Y- ]: t/ E$ K1 T, M( ^
ns_marquee.document.close()6 e# M7 i+ J) U2 ]$ [
actualwidth=ns_marquee.document.width
' ?. S  {+ B; `8 V; M, Y. b. D}/ m- ^) M0 ?$ P! \
lefttime=setInterval("scrollmarquee()",20)- M2 [/ O5 A8 S- _  m- }; I; \
}
0 {% u8 l1 M1 U: Ywindow.onload=populate
7 \$ G/ C2 V7 `! h  C
* g- ^5 k! }. f" P9 t  u6 T2 [function scrollmarquee(){
5 u0 \+ o" |* A9 y, A) ]( Hif (iedom){
; t8 v: O5 Z' Q. c6 L, Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 a* e( L; P' M9 {$ P: }7 tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* `" p- o4 B- I! _
else, _0 b  c& e2 [
cross_marquee.style.left=marqueewidth+83 s. g8 r, W0 g4 I% Q# s2 H
% R& ]# W; s5 M' P( n1 _4 Z0 p2 Z
}2 e8 E1 v! [2 Y5 ]7 a- {5 `
else if (document.layers){( X8 b- j6 f0 b' x
if (ns_marquee.left>(actualwidth*(-1)+8)). m  p  t) r8 f( y% ~' I
ns_marquee.left-=copyspeed) I) N; v. J9 O( _
else
" q( N: M0 L5 G7 zns_marquee.left=marqueewidth+88 d2 N0 I( l% |5 l, Q1 x% x! {
}8 A0 g  Y5 P2 U4 N; B5 d
}% k: W# c3 d" K3 S( y. p, I

+ v& l  o5 G! C3 @% `* Zif (iedom||document.layers){
2 q7 V# x5 z7 r/ `  z- l! l0 Lwith (document){
. p6 B# W- E1 W8 m& R( Q& \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 w9 ~3 p$ O8 {- i1 l# T
if (iedom){
2 N; W* D9 P' V; `% f" D2 j" T, Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" g+ o( T. x; F9 \5 c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 r, n7 O/ w1 O  H3 `; \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! k- [% e0 V9 B% k  X0 g- I
write('</div>')
+ `( A6 O# l* I# n9 }  _7 W7 P}
# j- W+ H6 Y+ u- s3 G2 b" R  Relse if (document.layers){
' {# n5 _& F+ U" \3 g% Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( L! |& Y0 y5 f! N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 \0 _  V/ e& u, O& u
write('</ilayer>')
9 D$ T& i- g! X1 K2 E8 j}
; \7 E9 m  \0 w: vdocument.write('</td></table>')
1 H3 R1 W$ U+ o  h# P}- X# U$ t4 G4 j
}! b  A. H2 h$ d$ d; D  m& E) r& ?# M
</script>

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