返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 [+ C! V; e* S) Q& F8 z  \& Hvar marqueewidth=300( R  `6 a! B, N) h" Y
//高度
( S3 K( ^# Z. K8 |- y# ]5 uvar marqueeheight=255 v, m0 Y7 e3 b
//速度(1-10)
- Q/ I3 B( p) D  d0 m, H0 Kvar marqueespeed=3
5 m7 s; d$ w% w+ q" t: B! ]//背景颜色
+ c! o: E; V: v% n; f5 k. }6 V# U$ cvar marqueebgcolor="#FFFFFF"
: r( {8 D$ C5 s6 Z* n//是否能暂停 (0=no. 1=yes)?8 B) a& C7 c  \4 h
var pauseit=1
4 }+ z. i1 D$ m# w" e+ ^/ w6 c( Q& q: N$ y9 Q4 y! {$ {' k
//修改显示内容
: Y- r/ c& y/ a) Q/ O3 U( }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& J: ^0 S/ B* {+ Q

2 R0 c' W: B- _2 W- r1 A+ i8 q
# d& z% q1 o6 `* H4 e6 b  D////下面不需改变////////////1 q7 }2 e& C; Y* H0 X- R; L
: ?% [4 J+ G8 K
var copyspeed=marqueespeed5 y# R4 D: ^0 X. _* W5 t6 m
var pausespeed=(pauseit==0)? copyspeed: 0: A2 Z, P* F; V* ^; ^' x% ~4 ]
var iedom=document.all||document.getElementById
, u, k6 U5 J0 H- b' nif (iedom)
; Z: U- ~, m. C" @: V5 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 @2 X* V: ^: o: @3 x* U' s2 B
var actualwidth=''( w9 s- k6 `8 \, S' M1 H/ u
var cross_marquee, ns_marquee9 w1 S$ ?4 q+ }  Q/ t* `

4 F5 k. s/ ?8 c* Nfunction populate(){
3 F$ y( F- r; M; \% s% uif (iedom){
: R" h- r4 g) v% t3 r+ Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! p/ H; [7 y# v4 J' xcross_marquee.style.left=marqueewidth+8- `2 o; A$ N2 h4 T8 C, T- C
cross_marquee.innerHTML=marqueecontent
+ |+ `$ h+ v" X0 Y7 A9 _( sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* f' L5 k5 J/ P0 [: J# u0 |3 ?5 n}
1 y9 F4 b& Z1 x' b5 ]else if (document.layers){& u7 T% _6 r0 P& S+ ?( A& M
ns_marquee=document.ns_marquee.document.ns_marquee2
' ~+ K2 H  U( x3 [5 Yns_marquee.left=marqueewidth+8
( Z: b( p+ m' x1 _4 ^0 Q8 u1 ^ns_marquee.document.write(marqueecontent)$ L/ e: b1 D+ G
ns_marquee.document.close()' Y4 n6 Y3 a1 y% Q8 f' m$ l- Q$ v
actualwidth=ns_marquee.document.width2 F/ N+ O  T: v- K
}8 m6 m! x+ P" S: @5 \. e$ L* d% b
lefttime=setInterval("scrollmarquee()",20)1 P  |+ s( @/ l
}
! Y- j; |8 n- t( T# {6 |/ M+ h# {window.onload=populate+ O1 `5 N5 N  |

- W4 `6 [% m( t5 b# y. U" c2 `function scrollmarquee(){& H* S" A$ L: m: T3 C2 n" P4 m
if (iedom){
5 Z  [+ P( x- ?) [; |7 G: [2 d/ Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( E' ~, Q- d4 ]% Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 @; Z5 y2 e4 {else
) D# i: R  [" n: D' B3 G% J5 _5 ^cross_marquee.style.left=marqueewidth+8
3 F& U  V  C, T$ [. f
" M% c% v$ O- `  a  P$ g! v4 A}
2 c' }3 J9 b  o/ n) Jelse if (document.layers){
. P3 r1 n  y5 {! M; |0 ~if (ns_marquee.left>(actualwidth*(-1)+8))
$ g' r/ C  O  p9 _: Gns_marquee.left-=copyspeed
5 S) l8 R# X# i2 H% {* R' Pelse
% F: ^( ^# v2 Pns_marquee.left=marqueewidth+8
5 B$ Z# ]5 {% i; i}- F1 E9 S( L( h- e: L
}
- z& s9 B" G. d1 ]& X3 x: c: @% Q2 L- K. |: `; p$ j" J7 m7 n; r9 t
if (iedom||document.layers){3 a2 ^! K+ W) \# }2 c
with (document){
- k6 H! M5 [% g/ Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( P8 C% V' B# s% mif (iedom){% p1 ~# {# F+ H5 Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, E' U+ C4 L4 S- K" q' w) Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): h' s* ?0 _6 a2 a* |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% ?  d) E) U" R8 q+ P; Q7 X- twrite('</div>')) V% y6 d8 q: `! J+ {
}- L, W. p0 u3 {# u+ ]+ f8 a
else if (document.layers){
- Z: I8 `3 E& V9 ^. pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 P7 `: ]1 v7 V, _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' f) R/ ~  m- \2 L+ ^# y7 _write('</ilayer>')0 f. Y( M. r* ~* M1 M' R0 L
}" |0 c2 \$ Y' V/ ?0 G( g
document.write('</td></table>')& k8 e$ e( k) [9 |3 k8 C- B( p
}
! P$ W) z3 K6 {, [' x}1 H* o% \& q$ ?1 W. ]
</script>

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