返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 V% d/ B! S7 ~( _! ^* I4 X$ m! `3 evar marqueewidth=300; T- v3 Z7 A+ q/ {  X$ {. p
//高度/ [- h  p! V+ E% R& r
var marqueeheight=25
( ?% y# X$ c- _0 B, S! G* |- U1 ^* ~//速度(1-10)
3 c6 r6 K5 f- w2 F+ }var marqueespeed=3" a( d  ~0 Z, ~  H+ v' [% y( d
//背景颜色3 m3 j3 b/ d' J1 ~0 J
var marqueebgcolor="#FFFFFF"/ b2 `$ o5 |* B
//是否能暂停 (0=no. 1=yes)?4 s$ q+ t! c; W0 `, {: Q
var pauseit=1; i% e8 b# u% d9 n- C, o

4 ]* r9 y3 m! R. n% f//修改显示内容4 j+ g* {; y, T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': o- T" Q  n1 Z
5 C* L; S$ M+ {% T' Q; j) c

4 i$ j4 q# u* o. I% ]////下面不需改变////////////
! V0 g- R, E( s) @( h7 X
) ^8 C. q. `; e5 \8 N' m5 Qvar copyspeed=marqueespeed
) p0 L# \7 y+ u; o, cvar pausespeed=(pauseit==0)? copyspeed: 0
# x- s" J1 ~3 \$ evar iedom=document.all||document.getElementById
+ w# p: P1 v3 Z) ~; z+ x' H& gif (iedom)
6 @' N/ ]1 ^2 i/ T- x0 zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ Z8 S0 Z* _* P" [9 ivar actualwidth=''! D* L0 K$ J9 ]5 M) F* {; h6 Q: s+ y
var cross_marquee, ns_marquee
: l, N0 s+ D1 E9 o3 {1 o4 |7 S$ h. {
function populate(){) i2 ?6 Z$ }; A1 J5 ^" W2 t
if (iedom){
+ x; i8 A/ P' T4 Z* Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  Y) ?  f; q; \+ v$ ^  n; R( Tcross_marquee.style.left=marqueewidth+8( f$ J" k2 n8 Z8 U$ k  K/ ~. W
cross_marquee.innerHTML=marqueecontent
2 r, b) _3 O( T4 y& Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 O/ c" ~% D- p9 ~( m- B. t}
, w8 t. R, h' O9 u* relse if (document.layers){; o; O, ~' {! ?4 Y/ [2 L0 |
ns_marquee=document.ns_marquee.document.ns_marquee2
9 \9 ?  k5 U7 ^) s/ C7 qns_marquee.left=marqueewidth+8
. d, g5 _1 F1 Fns_marquee.document.write(marqueecontent)
! J" o6 ~6 a* \6 C; W& X8 Qns_marquee.document.close()( D3 k  X) G6 v* [$ C$ W6 A
actualwidth=ns_marquee.document.width
: W$ I/ c% _$ D* ]4 p/ p}
. w2 c% j& T7 ?- |% flefttime=setInterval("scrollmarquee()",20)
4 ]/ s- z4 a9 z}/ v. R* i% T% H. v* u; Z7 W
window.onload=populate
) s2 ?& P+ ~; u$ `9 E1 I2 h' T
, r' N6 z) ]0 a# H  pfunction scrollmarquee(){
" U' ]2 I" p7 L. c( I7 Zif (iedom){
+ V1 u* {/ ?" z) [' |) E4 Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 _$ g4 w' F+ m- ^" z/ U6 x7 f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ x3 e( E, V. V; r" ielse
* ]) J) F* T  r9 ]; b5 [cross_marquee.style.left=marqueewidth+8; x1 G1 }( Q8 D( l5 X! X) Z9 J& ^. l
" N. \2 f* g* J1 ?5 X6 G
}
1 m* z$ p7 D- O- x# ^6 Celse if (document.layers){
% j3 x( `* H  h1 qif (ns_marquee.left>(actualwidth*(-1)+8))
/ N9 f" v5 i3 b- v; N2 gns_marquee.left-=copyspeed
  {7 e% e' ]" B+ q7 `( u7 @else  U+ F3 }6 p' E; G
ns_marquee.left=marqueewidth+8
# Q8 y2 s3 e4 T$ m& @0 a}1 {2 ?1 S* m* |' G2 X& p* N$ p
}4 c3 @/ k% o- m, G4 L6 D) G' {
. a' T2 e( ?2 w* Y: q8 |+ O
if (iedom||document.layers){) j3 ]4 a0 I& P% Q
with (document){
2 f8 \( M4 V2 O1 B! y* idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ b8 X; J( U" Pif (iedom){8 l3 s. T) n, T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ o! {# E5 N# |. X( u* {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 e0 Y( M& w9 e1 D% v# twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& W! w2 H- }) N. m  u; d
write('</div>')
7 m/ M* E  X4 Z- B" t" |9 n}
6 J6 i" ^& v  e/ _7 |/ M9 telse if (document.layers){
1 o& y( Z1 Q8 G0 c3 I3 k* Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* D2 @( d3 ~3 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ x: q7 U5 c6 `! S
write('</ilayer>')6 t2 e4 _# e% K. N
}, C7 m' x! o; k' J$ d+ X" p
document.write('</td></table>')
1 F3 e$ w" [% f: v1 K}
; V+ s0 |& H+ u' @% |" c}4 t9 F: y% o$ S1 L+ P  b2 _
</script>

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