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

|
网页之跑马灯文字特效
//修改宽度
4 ~ z/ A& _& [& G; w" yvar marqueewidth=300
5 d, ]1 k% S- X# c! Z//高度8 X- a: i3 \" t8 B* O
var marqueeheight=25
* ~, J* W# I/ p/ q2 }//速度(1-10)& w) O" \& p0 |" ?
var marqueespeed=3, J: P6 S% v8 }& S( o" Q
//背景颜色
! [! y- D* s* P) t3 u, D6 Vvar marqueebgcolor="#FFFFFF"
/ p/ _1 m; @) E# `. d//是否能暂停 (0=no. 1=yes)?) s, R2 F9 N" X4 S
var pauseit=1/ i' a4 f* g6 A/ u4 [# d& s
7 H% v! Y2 K4 q. C6 }+ A//修改显示内容
8 d- e( L- U/ Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ {) x5 o* O* |, F+ |* D) _8 y1 H* p4 H
8 f0 y2 i1 a* M# _////下面不需改变////////////$ j3 u) y3 l7 R; R3 E$ z
* ~4 g) K; Y. r, I Z" r1 a5 B c
var copyspeed=marqueespeed
, n) d: o, ]7 K |var pausespeed=(pauseit==0)? copyspeed: 0
% D; I* I* i: N$ |3 D) Bvar iedom=document.all||document.getElementById
# H$ ]6 l3 o6 b1 C7 wif (iedom)
5 z# Y) R$ V! O d4 O! u# s( Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# F: x% I- ^# ~8 z
var actualwidth=''. ?* ^$ L4 ~) u3 |
var cross_marquee, ns_marquee
# F$ U5 e# ?/ A/ T0 r/ K3 g$ D& x- m# s# @4 f z
function populate(){; ]. X# o+ p1 N% f1 ^6 O
if (iedom){- ?" I$ }/ n# R, {. g( c9 }, ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, q) y7 u. ~" l4 l2 D% Lcross_marquee.style.left=marqueewidth+8: h- ]* c5 a6 H0 _ q& |5 v! w' o/ _& K
cross_marquee.innerHTML=marqueecontent
4 J) i2 Q( n. a$ @, F, Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
o% `4 R' M3 `! b}6 X% N! b, D" \4 E
else if (document.layers){
6 q! F, i- X/ @6 Pns_marquee=document.ns_marquee.document.ns_marquee29 c& v X7 X. v
ns_marquee.left=marqueewidth+8
3 |1 p3 B! V$ {6 Z5 z/ J2 Q9 J. T1 u* Pns_marquee.document.write(marqueecontent)/ z3 D8 k: Y3 g' g# G$ M
ns_marquee.document.close()# Q, X7 G. J' J) j4 D3 o; J6 @! m* q/ |
actualwidth=ns_marquee.document.width
, L# b1 T( |9 t6 b}
5 {) `% W7 `( P9 [lefttime=setInterval("scrollmarquee()",20)4 x C: z6 p/ g' t8 {0 C
}+ q% E+ \" o3 r4 A: v
window.onload=populate+ Q9 Z. ~ I( l5 J/ f
6 _# w( L# [& ^3 h
function scrollmarquee(){# H5 J6 q3 ^: R6 K1 o
if (iedom){3 c$ w1 G2 U' m; C. _8 p" `6 _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& s; Y: ]- Z6 {+ Y; K, I2 r zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( x7 k6 d1 g. D8 H2 W8 s, t, q
else
1 k6 s5 t9 `! p: scross_marquee.style.left=marqueewidth+8
; R, E1 R# U- |- Z- o2 B
- T, z6 g! W' U1 M. O}
; |* w) H7 |) [/ ]+ zelse if (document.layers){
) `4 O$ X! E X# }, T: [if (ns_marquee.left>(actualwidth*(-1)+8))& A# }& [. s! k2 ]' Y, W" ]
ns_marquee.left-=copyspeed
% f9 A: D/ h i) welse$ {1 |6 J5 A5 n( F
ns_marquee.left=marqueewidth+8/ |6 D M" U( N. r
}
" }% J( @2 U, ~}
1 K% j+ t+ g+ l, y( e7 W2 I z+ ?- w& y! v [$ y( Z* _
if (iedom||document.layers){8 o/ F8 b. n0 D7 m3 p
with (document){
; l. y }' U6 Q- U. Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( N8 q' V4 X, _4 i6 F: w
if (iedom){
( m# y8 ~& X! _) F4 M5 Q1 r) g/ u" Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 V) S/ J7 M2 [, X- f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): B9 {+ ]( T3 j3 c; W6 w- Q2 x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! {9 l$ s1 Z4 |% S3 s
write('</div>')
4 `: m* M& J% ^! [ M+ T3 Z- n& Z; E" e$ l9 E}- y8 I% a4 ~" _* v
else if (document.layers){7 @5 \, N& }3 V ~# P5 h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! Z, R7 s4 c w8 f% g, I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# G9 y- W: C5 W8 Y7 N- n" h5 Gwrite('</ilayer>')
0 s% M4 M Q0 c5 F}
" Y* T2 z3 N! |7 W+ ]3 F Ydocument.write('</td></table>')
P- G/ H; ?8 c7 b% z8 w} ~) F$ E, @& q
}& [/ u" L' d; V7 Q( Q! d
</script> |
|