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

|
网页之跑马灯文字特效
//修改宽度
. V; r& Y( g/ o0 qvar marqueewidth=300
G! _# H# h' B' D' G& m0 V( m//高度" A# E+ j4 v3 q
var marqueeheight=253 j. r L( Z/ P& O( s6 ? K4 H
//速度(1-10). }* b. r; v) Z9 o W. P& n
var marqueespeed=3
4 L( g0 J/ h4 ^0 C//背景颜色& o3 c3 Y7 C; q! A1 ^3 v+ e) Y4 t
var marqueebgcolor="#FFFFFF"
0 \, q: Q5 k7 L0 e: V4 v8 ]; ~//是否能暂停 (0=no. 1=yes)?
9 S. @7 Q5 k! a1 yvar pauseit=1
1 S8 E* _1 v9 x. R) q' V, N2 W
) J6 w9 z3 j! ?9 O$ C0 E7 }, F |//修改显示内容7 T: {2 }0 w( [8 y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; X6 H0 a& {* i, H2 F
( O7 R4 r, @/ s4 e7 Z% z& E0 P' e8 D: Q" Q2 ?6 Z
////下面不需改变////////////
+ i; R9 c2 w. j/ o/ f+ s# |! j5 p! n5 b
& w0 p9 |5 @( }0 o! Q) G) Dvar copyspeed=marqueespeed
) `) \# ^7 W2 k0 _var pausespeed=(pauseit==0)? copyspeed: 0
}# @/ _2 Q1 h" X& |1 m S! I P6 ?var iedom=document.all||document.getElementById
0 e0 u' v3 m0 e, O4 h7 mif (iedom)1 {- s/ o3 a# M; O6 F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') x- p6 O( D# A) V
var actualwidth=''- z: p. Z) Y/ l8 o: L5 w, B6 X$ l
var cross_marquee, ns_marquee) H" E4 j" m$ z0 P
# a4 z$ N5 s; s6 v- M* P
function populate(){
* I! i- r. h/ Sif (iedom){
4 i( o( Y e! Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 w2 N! C" K( U) m/ R3 P' g
cross_marquee.style.left=marqueewidth+8# W' M8 }- j, |; y$ y4 ^ F
cross_marquee.innerHTML=marqueecontent
( F& f2 \6 I: {' lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 a: U1 B8 B7 p( _4 K5 N2 Q}8 A2 t5 r& A# y6 s5 ^
else if (document.layers){: D2 O7 O, g/ L3 N
ns_marquee=document.ns_marquee.document.ns_marquee20 G: M2 @# g0 p9 C
ns_marquee.left=marqueewidth+8
?% j) w) h( g tns_marquee.document.write(marqueecontent)
6 [2 N, M; c1 T r' F" d8 {; uns_marquee.document.close()
* w' Q. Q2 ^# q/ v' Q3 t3 `8 Jactualwidth=ns_marquee.document.width% S3 B! G. W8 d8 t& |* o9 O
}: @. |' M e- ?$ G. ~. s1 A
lefttime=setInterval("scrollmarquee()",20)0 D. A7 q7 c2 X% c0 h& @ W
}
/ |- ]0 p6 S9 ~& C9 `window.onload=populate! v/ R: m6 o) y# @( H
3 j+ }4 i( L2 }( w7 d% E
function scrollmarquee(){
# h8 L. z, C; r1 v# Yif (iedom){7 }$ a+ n5 R3 j9 C% t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! L: x) s$ D/ ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 w- F% B3 p: u& F
else
. I+ z7 n, ~2 g @cross_marquee.style.left=marqueewidth+8
$ @2 E4 c0 A/ Z( o( u
! {$ C) q( `$ \! r, a* N t}5 ]4 T O1 C6 \( ^6 K/ R
else if (document.layers){
) a% {3 e) |8 \" l) V# Fif (ns_marquee.left>(actualwidth*(-1)+8))3 u' v- C w9 A* P
ns_marquee.left-=copyspeed6 q) G" X. l2 e; `% e
else/ R) _' S7 t9 K7 P- G: W
ns_marquee.left=marqueewidth+81 p# [% @, M# M8 ~6 \
}8 j9 L: k" G0 e/ {# X' E1 K
}; Y9 C. Q$ x3 l2 E1 X
1 v; g2 V. D+ k; J- y7 o$ k6 d
if (iedom||document.layers){
+ V4 Z! }( }+ p9 a7 i2 kwith (document){' J0 s8 h7 b/ |$ z7 Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' w) ^6 I+ n2 Q5 z. wif (iedom){
; l, D5 Q) p' l1 O, @( I# bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 U0 U1 T6 k# w: e* r# h! M* p8 Q3 e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) d8 E) ^/ p/ U1 Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' @7 f. L- {! x- F1 w) z
write('</div>')
% x7 e2 A# `8 _- h9 W/ |$ u}( m# o8 o; s' d; f
else if (document.layers){
/ N0 M5 x8 t) v, W: a' U3 dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 @, ~/ O3 M" S9 I8 r' twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* i: r1 ?7 E! p+ e- R% s0 u
write('</ilayer>')
4 q2 N) v; l) L) b. q1 D# O}0 K' s( J9 Y3 M& T
document.write('</td></table>')
$ M3 T. j: U1 Z) u! W}% n3 ~+ C- }1 Z' v+ ~ P5 W+ E8 X- U, n
}
4 q9 P: M' G' I2 l</script> |
|