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

|
网页之跑马灯文字特效
//修改宽度
2 W0 q& @! i# F3 {var marqueewidth=3006 B! _0 a) S8 @1 u9 n5 T
//高度5 T. U5 N3 ~/ | V$ e6 {; E3 k
var marqueeheight=25
F: `0 b0 C6 M' q2 j2 u//速度(1-10)
6 v: i1 j; i/ _. G. evar marqueespeed=3. F' |& Q! x$ f) T9 X, z1 k5 E. d
//背景颜色% ~$ _: ~, ^9 {
var marqueebgcolor="#FFFFFF"
# d* T9 p2 @: D6 t N/ X//是否能暂停 (0=no. 1=yes)?
T0 |6 b/ k/ |1 x( [var pauseit=1$ e" z; G9 B8 \ ?- P
9 R& Y5 ~0 Q1 L( H! U9 v//修改显示内容% h* x1 x8 T- n. L$ b2 m/ i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 y; l& T' E& f/ H& \* y
$ x% ?4 _5 a* M" q. R
- p2 U X/ |* S8 p" h////下面不需改变////////////4 y2 }% I9 a1 V& X& ^0 ?, }
7 c9 W& F6 |/ j
var copyspeed=marqueespeed$ N2 V0 e6 m( x0 j) T% m, D
var pausespeed=(pauseit==0)? copyspeed: 0
9 h* N4 `: E( Q: b, R2 h$ R& P% ]var iedom=document.all||document.getElementById F" ?$ _2 g6 m( S: g
if (iedom)
5 ?5 }8 X! o) K# Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' |/ m! Q& |% l2 @0 q2 \, H
var actualwidth=''8 I: O3 h3 }# V8 \$ M, ]8 U
var cross_marquee, ns_marquee0 S4 q& _9 }$ o% c
: ?/ r' _ p- ~0 A% D
function populate(){' S, Z. O( X% L6 m2 M6 o' ~ _
if (iedom){
8 W0 _: K9 g! o3 l5 across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! z# a. U! K; V+ a7 icross_marquee.style.left=marqueewidth+8
( q& y/ @+ e0 {/ T ?# Ycross_marquee.innerHTML=marqueecontent" ~2 s3 H! h' L X- D! Q/ ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% O& [9 E; X& H6 Y8 |# N8 M$ C1 v
}
2 C1 z# n8 |( uelse if (document.layers){
( L0 F$ X! G- s4 ?2 y# ^ns_marquee=document.ns_marquee.document.ns_marquee2/ \% r. T9 ^2 D, N2 p. _) y7 ^/ Z2 J
ns_marquee.left=marqueewidth+8) \! `) }, o; _) m% ?$ K0 U' {# {
ns_marquee.document.write(marqueecontent)
: r* x3 o9 i, _4 A# @ P' sns_marquee.document.close()
0 d' o1 P% j( ?, r& ^8 s- d1 w% Factualwidth=ns_marquee.document.width
& b5 r! `' L: {& F+ Z% U+ N+ E8 I}
5 y- ?& {* A( klefttime=setInterval("scrollmarquee()",20)8 L& N) B* \+ L
}" ?+ F0 U/ u* T1 n
window.onload=populate8 ?% u. p; g& i3 ~* H( ^
3 e, G) I$ F0 e) a- c5 Ofunction scrollmarquee(){, z) g/ T6 o( s2 [ D7 f, C" }1 Q2 S
if (iedom){& J* V1 J2 n/ d! P, Z& [ r% F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); g0 H9 R; N: X: z' T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& T& \3 g4 j! Z' T9 A# l2 S
else) a: q2 E) a, n, ]8 h, z3 n5 ~% u0 _1 n
cross_marquee.style.left=marqueewidth+8
/ K3 E) B! B, s1 |& K
9 y: a/ o3 R0 X/ ~' B, d}8 j& k+ \, h/ L0 L
else if (document.layers){/ o+ d+ y H) l! I3 ?
if (ns_marquee.left>(actualwidth*(-1)+8))
6 n! y( Y$ [& z# m! t! J' d; \1 uns_marquee.left-=copyspeed
8 Z6 Z& A, {- r7 t1 E, j7 W1 aelse* L( ^- p2 {2 _
ns_marquee.left=marqueewidth+8 z9 C* q# R8 ~4 C2 l
}
9 [% G" y) T7 S3 r+ m}
2 W3 ^( Y+ g3 s; y/ r. ]+ m9 y* b+ P! v2 N
if (iedom||document.layers){
6 R$ \$ y- x5 b) }' m% nwith (document){
* {3 R) _; r0 C( s4 ]8 [, mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* V% O" ?, b! D4 {8 Cif (iedom){
8 ~" |6 V: v% z! G1 I6 e& o$ Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' A: j0 b/ T( j1 U: awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 H1 \7 ~8 E' u6 Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" C W7 i1 S8 |! r
write('</div>')3 H; X0 @5 \2 A8 g
}' F: z* S' L% }8 F: y7 g9 {
else if (document.layers){! I% l4 Y* J( C% U4 c' t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 w% R+ Q$ d' V3 p. `; j/ h# g9 A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# X4 M# Z# _8 p: U% Rwrite('</ilayer>')% X8 A7 n( S# B, i% @5 }
}. D, ]' O% [/ Y# E6 J2 N% Y+ {
document.write('</td></table>')! x! J7 G8 A/ L% H+ d& H: J
}$ Z* }& d9 r& Z
}
! w5 ]* `( u, {7 p$ v0 o# `" q+ o</script> |
|