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

|
网页之跑马灯文字特效
//修改宽度% H% q4 A2 y A& ?4 u, n0 q
var marqueewidth=300& f& A5 X% N% h. E7 S# F
//高度
" n- a# w: Z0 \( R& F9 w9 A9 dvar marqueeheight=25/ M: Y4 d8 j7 V
//速度(1-10)1 }; k( D: s; o) {2 Z' K
var marqueespeed=3
i0 a4 g( t# E6 X( S# R" b/ j4 ~//背景颜色7 T. m+ \1 t$ v$ G+ o/ K" ?8 _
var marqueebgcolor="#FFFFFF"$ Q$ O5 N5 C$ _" f8 S
//是否能暂停 (0=no. 1=yes)?
3 j" @: [! z2 Xvar pauseit=1! K" \( |0 C3 g, w) O$ W) A7 [
4 x/ ]/ x$ F+ J2 }5 W
//修改显示内容5 H0 |8 k% J8 e8 U8 V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! g5 ~" U/ |1 t- }* e0 c8 C k" u9 v* J! X/ G% M) j G4 W7 W
; i% \1 @5 F) ?8 ]////下面不需改变////////////; [: E) x: B: z. d: r
3 i2 a3 A3 y" e
var copyspeed=marqueespeed3 S% j* k: t9 A, E( y
var pausespeed=(pauseit==0)? copyspeed: 0/ K" p+ D, k+ L
var iedom=document.all||document.getElementById
; z- ]% ?# t4 z, C( g4 g. eif (iedom)( A2 x L' Z1 ^* A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% n( G! D' R: k& C F; O# A
var actualwidth='', Z+ q( h) {9 D' n. t
var cross_marquee, ns_marquee7 C* F' _* {# P. M
. v( Q: U0 Q+ N) Sfunction populate(){
+ k0 a- o/ x8 |4 {0 hif (iedom){
4 P( y6 q. ]$ H5 u: Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: a0 ^1 U$ z9 c* b% H8 K- d7 Scross_marquee.style.left=marqueewidth+8
$ C, w9 [! ~' ?" Q" t" pcross_marquee.innerHTML=marqueecontent
; I n9 |! |+ S. e5 K+ k' Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, P& M I M! d/ O4 Y4 s6 [6 Y0 p+ L
}
4 P9 p, z1 W, ^5 w- {else if (document.layers){
3 J% I+ U/ k3 uns_marquee=document.ns_marquee.document.ns_marquee2* F/ J/ e- S+ ?8 W
ns_marquee.left=marqueewidth+8
$ C2 _7 o9 p' z5 V; N! S# Ons_marquee.document.write(marqueecontent)& |3 d+ h7 L- C; ]$ e0 X
ns_marquee.document.close()7 ?- {$ i0 W$ e' ?. w, i" \5 L
actualwidth=ns_marquee.document.width
9 l6 z9 E7 f9 {}/ G, w" Q$ _9 u, G8 h
lefttime=setInterval("scrollmarquee()",20)- i* G5 E( ? C
}2 e$ G9 e1 t: t' b7 d& c+ N
window.onload=populate. ]2 u$ Y" v6 k, c
' Z7 H: u" L1 V/ X$ {function scrollmarquee(){# h- p5 }1 H7 ]7 _5 p7 M
if (iedom){# I/ b; g. ]* j- U7 [3 t$ x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* n5 d4 e! O- ?6 a# h S, d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 h e' h9 A5 pelse
4 Y9 m9 v% x5 T- d6 {. bcross_marquee.style.left=marqueewidth+83 J' e1 u! a4 e' Z3 _1 X& J
' c2 c4 b' @2 d* i}
! k5 R1 Z1 D0 U8 Yelse if (document.layers){( D. `- Q) X' p3 n& [ Y
if (ns_marquee.left>(actualwidth*(-1)+8))8 [# B- e' i4 h. h3 }6 N
ns_marquee.left-=copyspeed
1 V$ P( o, w, ~% u; u5 G. Yelse0 r4 z5 q( v' ]& g
ns_marquee.left=marqueewidth+8# F$ Q! d2 C( ^8 } L* n5 I2 }
}
- i; W9 Y4 C" f v9 x$ }}
( B! {7 k) j- q, U7 ]8 D! w- i; m3 j i
if (iedom||document.layers){* e# L2 h6 T4 V7 h9 y4 M0 |+ o- ?
with (document){# Y+ o+ d6 p. D1 k# F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' n8 e0 a1 W: w6 Yif (iedom){: _* a! a$ E. O. v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* p. O6 _' C; @! b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* l- s; G. y2 Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 h7 R" w, f+ Y' l
write('</div>')7 V# ?" d! ]/ r" O9 X9 w: I
}
6 f$ X$ x2 ~% aelse if (document.layers){
+ B1 c* M& h6 r4 kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) h' h( S& {3 @6 E2 R1 L' twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 S& \9 j; I- S3 H2 a
write('</ilayer>')! C- b8 {9 C) Q! d# Z* r, z; _( ?
}
" |8 y* k5 t' J' A% [5 F& qdocument.write('</td></table>')" g& i& o) m* g
}
/ v0 [) I2 s" R}- z9 F( N' p6 l B. ~1 O
</script> |
|