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

|
网页之跑马灯文字特效
//修改宽度
+ @, J3 X" L: _) G+ I, Ivar marqueewidth=300
! J+ o0 d! O/ G; Z4 `//高度
' Y% H& H y, C" Uvar marqueeheight=252 N b" z4 s' S @
//速度(1-10)! \4 \ b& @+ l
var marqueespeed=3! b5 T9 D' }4 b+ q* U; @, [
//背景颜色
* s) p4 S0 P' X E! `( H% `# Pvar marqueebgcolor="#FFFFFF"+ c( h0 R. C P9 L8 t: h
//是否能暂停 (0=no. 1=yes)?
7 _5 |# d/ u, F7 Lvar pauseit=1$ x X3 V# R8 c
R6 j4 V1 k ?; W1 E( B//修改显示内容+ l8 p% k! H" X, s3 {: i. M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' f3 I' N$ ] Y6 f; N4 a
1 V( ~3 X1 `1 g: ?9 ~
~# R, e- N& Z& h////下面不需改变////////////& i2 y' D4 _4 }+ }4 I4 W4 r
) a0 {0 v$ y: l, Dvar copyspeed=marqueespeed5 c/ c# j7 c. q3 M) w' |" T
var pausespeed=(pauseit==0)? copyspeed: 0 [4 L8 M8 Y2 |# A* o
var iedom=document.all||document.getElementById& A$ M# n# }6 W0 a0 @5 Z
if (iedom)% O% ]+ d: p& H- o: _7 O$ G4 J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. l! ]( W; ]6 z' H U. J6 Yvar actualwidth=''5 |9 z4 g9 F2 y0 E; V5 ~! z$ i4 ^
var cross_marquee, ns_marquee' \/ N6 b' b8 n# g M7 L, z- H O
; z2 w% L4 ?& H( `* @function populate(){0 {1 L. ?- \8 b
if (iedom){: {8 ]( Z% @8 n% X( F! w4 Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# T4 }$ L2 M2 Z) I4 I1 rcross_marquee.style.left=marqueewidth+88 [3 Z0 T2 K: \
cross_marquee.innerHTML=marqueecontent
5 b) z5 ]( Y1 Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) o0 L4 I" f9 J' T" ?}
( U: k) P: f3 `+ s6 Melse if (document.layers){7 I; v: l$ S1 K
ns_marquee=document.ns_marquee.document.ns_marquee2
5 J$ B; |+ s" @! b' c7 U; \ns_marquee.left=marqueewidth+8: L+ s8 E% [0 C
ns_marquee.document.write(marqueecontent)
# h; o# \# O$ W+ T% h, Ons_marquee.document.close()& Y+ F0 [' T& X V/ ~3 e7 ?
actualwidth=ns_marquee.document.width
5 }; E+ a; ^; e/ W( z8 g$ u}
7 ~- S" @; H V1 O8 ?, M# Vlefttime=setInterval("scrollmarquee()",20)
; [& A% Z. t( u: }! |9 @}: }% T8 _' c7 B: {
window.onload=populate p, @9 W6 Z% I2 |6 G/ g
- b. N3 Q4 q4 _+ H* S$ H8 afunction scrollmarquee(){9 W0 |" R% B" x) M. Y* c" w
if (iedom){
* y! J+ X9 ^' S/ I6 }* mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" x/ |2 H! ~6 W6 u/ gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# g/ y* T2 i: u/ |" selse8 H$ ?4 |! r; H( I# t3 M& R
cross_marquee.style.left=marqueewidth+8
* h; O; A& ~6 W' C |. k R9 U8 V# g# D7 k) B8 x
}
* y" O" y3 o0 w) {: H; aelse if (document.layers){
1 M: l% q' L2 }& qif (ns_marquee.left>(actualwidth*(-1)+8))- ~5 L1 y( z' e& h
ns_marquee.left-=copyspeed6 Z# v2 k5 ~5 o1 W6 ^
else6 J! j! Y( x# s& I
ns_marquee.left=marqueewidth+8
3 ]/ s7 g+ A' {5 y. M- ]8 a/ o6 r}+ g& w/ [0 R, E$ b1 Y) O
}
7 G8 ~ {* W& E7 F1 I4 Z5 x1 h' P4 L8 T7 u5 C$ C( f9 o) C: F% D
if (iedom||document.layers){4 B5 @ ?5 q% X# [5 {$ [$ L$ F1 d i
with (document){" L# L7 o6 I# H# G9 W" B: e9 J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 k: Q# ?6 K; h: Y! B9 d# a
if (iedom){
! e: N; q- Z+ O0 n' q0 Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& Q U: E4 } K" }" y0 o0 Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), O% v2 } i6 b0 o# S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- `/ C& ?& }. qwrite('</div>')
7 ]/ I- w. c$ `2 \1 |}
# |0 _) x! T M1 selse if (document.layers){
9 I' i8 b; x$ q; t t/ i: kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# H! h o2 J- wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. p7 A3 `+ J/ ^' {! |write('</ilayer>'), q2 \5 H: [3 U% @. m& E
}
' d& `8 S- j/ R" g$ R* k' idocument.write('</td></table>')
( H. a7 [0 G" q}5 r l, K# \& \. j
}
6 I v- X; {+ E. F</script> |
|