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

|
网页之跑马灯文字特效
//修改宽度" s2 A |: O5 u+ m! Y0 H' t2 ~
var marqueewidth=300
( @ v2 V* y) L//高度
; X5 a- |* Q7 F. J5 |; e8 ^var marqueeheight=25
6 F; y Y" `/ J' h1 K5 u, w7 |//速度(1-10)7 \+ J$ |2 u, H$ W( ~
var marqueespeed=3
8 g; a# f$ K- b) }2 k0 ?6 ^//背景颜色
; n. z- X' `9 l" q j# `# Cvar marqueebgcolor="#FFFFFF"' k9 w$ [. h3 V9 j0 \1 ?% {" C- {; Z: Q
//是否能暂停 (0=no. 1=yes)?
6 `% ]7 O& M. d/ h; \! Y' E' Avar pauseit=1
4 P( g( p8 L* g2 J- j
/ z! E) Z0 n9 H//修改显示内容
4 d8 S( a$ } q7 Q" b/ S7 ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 L* K: g4 M* n( s0 C/ _2 E( t5 ~
+ m1 ]" j2 C" ]# S0 X( H* ^ j& g2 i! ^: V' U$ G" |
////下面不需改变////////////9 j% q4 ^) E2 L' ]; [9 c4 g1 I7 P
3 _, h% J0 a' g9 Ivar copyspeed=marqueespeed+ \8 u9 Y2 ~. L- B% T2 @, R& ?/ F
var pausespeed=(pauseit==0)? copyspeed: 0/ I9 u5 v' Q, H) n# y0 V; q* _( T
var iedom=document.all||document.getElementById
) C9 L6 f( i" {1 b. eif (iedom)) @8 |, {- i' x% P% V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 }2 M( X9 b5 h# w& M6 i' w
var actualwidth=''
- }0 y8 s) K& c. y: F' Uvar cross_marquee, ns_marquee! J- p5 q! S! s- K* I, }# m X& `% w
4 q4 _/ N `2 s4 \function populate(){: p1 X8 W* |& e; ?. B, v: a
if (iedom){7 f# ]! ?9 a* u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 ]( ^9 O3 Z& A# J# gcross_marquee.style.left=marqueewidth+8
* B( {0 L, Z+ A0 K6 Y+ k# G: }cross_marquee.innerHTML=marqueecontent" H0 Q' }" c9 g C. }9 v" @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# y$ J$ @' ]* J/ [5 @9 Z/ v}
% X; b4 N- H5 F9 Melse if (document.layers){
/ ~$ s* d7 G$ _3 Cns_marquee=document.ns_marquee.document.ns_marquee2- Z5 N% r) m/ t3 T- Z1 p& C# `# r
ns_marquee.left=marqueewidth+8
$ g! o& ~7 |5 j+ z }ns_marquee.document.write(marqueecontent)
/ k8 @9 m3 m% K4 R* l( qns_marquee.document.close()# q7 f. A* G9 L d# Z
actualwidth=ns_marquee.document.width
, E8 [8 L2 x) m+ H6 V) B}
0 Q1 o3 G6 a3 T; f2 r$ N' wlefttime=setInterval("scrollmarquee()",20)8 z& q6 m) g& r+ U7 {) l* t
}; ]+ O% J- e: p3 C: \9 _
window.onload=populate
1 F! A* c, B9 j8 d
* \+ d2 h% r5 z+ v6 pfunction scrollmarquee(){
* `1 K! ~5 H7 U6 Dif (iedom){
# Y" O! ]% i$ ]& R5 U0 i4 j: Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# P7 J0 e& D; x5 C' y% q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 x# m$ W. Q8 n: t# g7 B" m
else; P+ E3 g+ b* w! z9 o/ Z
cross_marquee.style.left=marqueewidth+8' w$ S, b r( p- D ?1 g. O% ^
- Y, R0 l7 O. F: Q}
9 R* a6 e: B+ C5 `: w% f- ?else if (document.layers){
0 X$ }; v, U+ I% p4 Oif (ns_marquee.left>(actualwidth*(-1)+8)): S) h1 b' c- H, {
ns_marquee.left-=copyspeed
! V/ u1 t) x3 q/ g$ Ielse
6 Z! p8 j7 ^! J. X. b e9 Sns_marquee.left=marqueewidth+8
/ r, J% f4 L9 X}
8 m* h- a2 _ ?4 B: [}: P0 Q4 k9 N0 v, M
) J9 T; u8 A8 n. t# Vif (iedom||document.layers){
9 A% E% _5 O8 i4 c) fwith (document){
. L0 D B: V+ [0 L. f, F# x# K/ Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 R$ t7 e. [' z' }6 P2 Aif (iedom){
/ X) F2 O8 b# Y& r- e9 u9 dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 C+ g: d0 a: M, k4 {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& G; G! M( T5 S. V, @% V' qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ l5 k1 Y- s- i/ {1 g. z: X: X5 [write('</div>')
, L* Q& k1 Z1 T# E% m}/ g0 a! U- i2 N, {; m1 W
else if (document.layers){# Z8 y- M; V! c' H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 F" R4 ]: }, y9 s/ S* {; nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, ]/ G9 w% [3 \3 {2 ^. Vwrite('</ilayer>')
/ m+ a% l1 N9 n, W7 z6 X7 x}3 o6 Z4 ]2 d! ^
document.write('</td></table>'), `. q+ O; E1 Z1 z
}* b# G5 y" X! J
}7 }" w. U) Z- ^
</script> |
|