|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
8 _& }4 f5 I* z% }( O+ Zvar marqueewidth=300: }" q& N1 f$ m; [# L' r5 y
//高度
6 F9 b7 P" e4 k2 F# j2 g# \3 Fvar marqueeheight=25+ h+ C- ^3 X0 t: v8 s0 X
//速度(1-10). Z/ p2 M0 P; w* R
var marqueespeed=3
2 M$ a: C( F+ ^1 t//背景颜色
* F+ E1 P/ g3 ^# evar marqueebgcolor="#FFFFFF"
4 t) u1 n2 `/ B W9 J) l- N//是否能暂停 (0=no. 1=yes)?3 r- M. ^" Q5 [2 z+ I8 B' F9 u
var pauseit=1- G, I* K2 l5 u }
0 r' G- E4 K" x! x//修改显示内容
& h/ ^$ f7 T& \. n9 U7 a F8 yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& }# l: d2 G5 c- r8 X& `) H3 `9 |
2 R" y Q+ A, K6 q! Q# j
& t4 j4 ]6 v) H) M" ^6 Z
////下面不需改变////////////9 i$ i) B/ W. U
. U- ^' y- _! I6 e1 I% i, zvar copyspeed=marqueespeed
% r9 X9 _5 u- N% A. F+ k1 Ivar pausespeed=(pauseit==0)? copyspeed: 0
/ C* ]/ ^. {$ i, J! S/ lvar iedom=document.all||document.getElementById
6 ~( Z/ L E3 g! `8 E) b: _if (iedom)# e% E* S% P- S6 _+ o% `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! g4 ?& n V2 |
var actualwidth=''6 B. j6 R9 ~' r5 b4 H3 u- U
var cross_marquee, ns_marquee
; U, |4 E; k- P: E6 L+ c6 F( ~# R1 P
' n; `, q9 j) e$ s! u2 n1 I/ J3 Tfunction populate(){
2 q7 W c6 z* p( R/ d4 cif (iedom){
5 F1 n& D/ C; m0 E F0 Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 ]0 i/ T d7 E
cross_marquee.style.left=marqueewidth+8
! W' ]3 k# X/ l( e+ j4 j; S+ t$ hcross_marquee.innerHTML=marqueecontent8 h: J. X) z+ `3 [/ F# K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ h- `6 w; Y! I4 _
}4 l/ W+ h. v) g1 v. O! } }
else if (document.layers){
7 I' }% ]3 L" Q' kns_marquee=document.ns_marquee.document.ns_marquee2
8 w9 O2 i& \1 R! y5 t0 \ns_marquee.left=marqueewidth+8
6 [) P% r2 S7 C$ Ons_marquee.document.write(marqueecontent)! M( R a: m& x5 l
ns_marquee.document.close()# P3 Z4 Z, t# P' c8 J$ I, V- [$ b
actualwidth=ns_marquee.document.width
+ @) J& P r9 ^+ S# l) d}
, o* ]. m _; {7 |1 s8 x8 n6 `% ~: S; Blefttime=setInterval("scrollmarquee()",20)
& F0 r7 c/ l) ?: m3 B}
5 B4 E5 g' [: k0 W; i) a4 I$ Wwindow.onload=populate
& a2 [# K0 j, z1 d- B9 c5 q4 I- Y0 r1 _1 A0 _: d. w
function scrollmarquee(){
; L M1 d1 u- q* Yif (iedom){7 C# M: j2 t" r5 I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# v: T/ ?" H+ U% ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( ~6 B( T4 ?3 E
else
' t8 r9 U4 l2 o( p4 Ycross_marquee.style.left=marqueewidth+8
0 v1 Q" ]( O/ |3 @, R
; X" a6 ^# h( d% j}
. i8 t4 P( a; _else if (document.layers){# T6 |, y% \. B9 I
if (ns_marquee.left>(actualwidth*(-1)+8))
" W. o1 Z- M/ S7 x2 {ns_marquee.left-=copyspeed
3 v. q6 S$ x) j9 velse
& |9 n+ Q6 w1 gns_marquee.left=marqueewidth+8
0 _3 ~0 P+ N% m, P: |7 F! P/ \}2 o( }' r/ d; H- ]* R5 }' |
}* N1 T9 K, O( I' @
9 Y, A$ ~7 p3 D+ E$ ^* W. p9 B9 M
if (iedom||document.layers){
# o6 y) V1 S9 h5 ?6 g; s! ?with (document){" G- j- f' ?* y* T* X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# A: C& {8 {4 A# A
if (iedom){1 l2 R# C" u2 ]1 b: @3 B/ E( v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! ^/ P2 B1 s: o4 h7 Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 X& b& ]8 p2 awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ Q B# e6 d/ W" O6 l% s
write('</div>')
5 ^! c: i4 x3 I! o/ N}
+ B4 h9 ~! ~! C# i( x h! ?else if (document.layers){
4 _& N) V; N! K! x5 B2 l! M7 c/ |5 Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) q$ w/ F+ U$ z" Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# e) a& e, t' J* T; Kwrite('</ilayer>')7 n4 X* p3 S2 j- Z: E1 H
}" @ I- c" v9 V5 Z* \5 `6 m
document.write('</td></table>')
7 L3 R x3 X" ^( _- v# @( x}
' P! p: g( j5 {! d* J0 D' u}
: D9 z2 i8 o+ f( D( y7 W8 T</script> |
|