返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ b: _% W+ h' ^/ `4 x8 Cvar marqueewidth=300
% S% s; Q' a1 u& |4 T) J- U//高度" O+ x/ \" q% K# D
var marqueeheight=25  |) f* s+ {+ |5 i; e* A4 c' F
//速度(1-10)# `& {& S# R$ r: Q3 ^* k2 K
var marqueespeed=3* \0 E0 I" D; h% e; R% e
//背景颜色9 O7 _# [4 p1 k$ Y* P* k0 |1 b# M
var marqueebgcolor="#FFFFFF"& j9 i: X6 N& G4 v( v; @4 K- N  v
//是否能暂停 (0=no. 1=yes)?$ F* c. C- C# w' J7 S+ C: k6 S
var pauseit=1+ V( A" P) q8 a5 R( k' F

/ D* \8 i+ w0 p6 b1 W( P, J- I( M//修改显示内容6 z* C0 v$ ]2 }2 N! i1 p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* {9 r5 C) h, @$ g$ d2 V
, r( i! Q( m; y  `* P- z( ]

" e* ^# \: w3 r1 {& h////下面不需改变////////////: M8 z# P" J: S$ _% _8 M

; z8 `# A" s, Cvar copyspeed=marqueespeed, X- J# _5 ~8 ~2 D/ Y
var pausespeed=(pauseit==0)? copyspeed: 0
7 m! ^0 l) A! X, x  M6 g7 H, G$ }& S+ Cvar iedom=document.all||document.getElementById3 T2 l  }* {  C
if (iedom)4 @( [* v* E: v# S# H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# B7 U! l! r! l0 b2 b4 l: h1 x+ wvar actualwidth=''
3 @5 Z9 O) i9 Q+ Ovar cross_marquee, ns_marquee
( Q: T2 R* i: E" @" @
2 e' G" g$ l( wfunction populate(){
" q4 T5 D" @' z5 O' xif (iedom){7 k) u' ]: M- `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) p* P# Y! g& \: F# U, l3 Z( @. u  Dcross_marquee.style.left=marqueewidth+8/ d7 M% i- M% b% F3 z
cross_marquee.innerHTML=marqueecontent
3 b4 p, R; C& h" _  cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# g& ]) o; N2 z: R$ L; H+ }) r' j}  ]3 H+ j% `5 y9 y8 p, w" y) ~
else if (document.layers){
" x) Z+ N' G" F$ `7 i0 u( [ns_marquee=document.ns_marquee.document.ns_marquee2. Q% L0 p+ Y% z: @1 h, B# \
ns_marquee.left=marqueewidth+8
* d9 m/ g! j. P6 tns_marquee.document.write(marqueecontent)8 P+ Z1 A. e% c8 o) j
ns_marquee.document.close()$ g# A$ y$ K. f2 Y# u. q- ~
actualwidth=ns_marquee.document.width
3 ?: e0 c- t7 H! @. L}
( X% k. M9 `- Slefttime=setInterval("scrollmarquee()",20)
- A' M$ l6 Q% T8 C; @2 M7 s}+ u! c' X2 C( u, M
window.onload=populate; Q" j/ u0 B% ~3 N. I( Z

/ K  k) W# ~$ M/ I+ Z, Y* zfunction scrollmarquee(){
( ?4 ^! O' \% R3 fif (iedom){8 g; f8 Y: }  X4 H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" `0 W) n5 Y8 M% f, N7 u  m. Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, V5 I2 q7 F  E/ \else* N: n2 G, l/ y
cross_marquee.style.left=marqueewidth+86 h" e/ }$ H! ~7 E) U
: k4 Z/ h' w# u: E7 L2 w7 S7 e5 K
}
  p8 h/ p, C8 k! W9 G0 Gelse if (document.layers){
0 a5 ]  h  e) K+ x$ }- Y8 {3 U: `9 vif (ns_marquee.left>(actualwidth*(-1)+8))0 p( {; v- f8 @: @/ `  C
ns_marquee.left-=copyspeed  {& ~$ m- `- }- J
else
. h% c6 t; X, h; O2 B3 ~+ zns_marquee.left=marqueewidth+8& f' u- Y( T( b+ F+ r% i9 H2 e
}
$ z* ^- B- z1 T: ~/ Q}
; l- W, i7 s3 X! A9 H# U. S* s! G
% o. i$ z# m8 D0 E4 Rif (iedom||document.layers){. j" [! f; s# l
with (document){6 U- t4 W2 D9 h8 D& ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- w  r# x& y! D' u# O' H6 y. L
if (iedom){
5 x# v+ F$ S: f: Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 W& @  U6 d6 C: \$ b  s/ u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; |" w" }* I: p, W7 L5 D7 c2 |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! Z$ p% ~7 g$ Mwrite('</div>')3 l5 Q3 p, U7 \- w9 ]" `# r
}
/ i6 A" `( t, uelse if (document.layers){2 `' ?& K. b- K1 ]2 k8 k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 R2 r( W# R( m$ q% y. K& r/ x) U' Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). }6 L2 E  L& K: i
write('</ilayer>')
5 ]4 R9 C9 g0 G! e3 y7 ]}# S: z+ u0 l7 X$ J9 e& I7 b' M
document.write('</td></table>')+ N+ G$ ~9 h7 g4 _  k
}$ f/ I2 W6 s3 P
}4 H$ ^0 W% x8 r# g$ s& V: P/ C- a
</script>

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