获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( c3 ?$ `  D7 O! B3 L- O6 X1 `var marqueewidth=300- V! O1 C# H; t# U4 v9 S
//高度
0 r! a7 o7 Z; u9 a# O% q9 u" yvar marqueeheight=253 `( z1 s1 W& S, W5 f& d
//速度(1-10)
2 H/ h" }3 Q0 a- B, I$ ovar marqueespeed=3
& v; x, `1 F; W" d//背景颜色
; _* T  K& t1 C8 K! c) avar marqueebgcolor="#FFFFFF"
, W7 {' r. @" N1 E+ R//是否能暂停 (0=no. 1=yes)?7 F0 c0 [% t/ G% U2 ^
var pauseit=1
6 S: Z- E6 R1 l5 P
. Q6 q# w3 O: a5 F% b. _//修改显示内容
: A/ G7 k7 ~- `% f# c8 h0 Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: r; A( U7 g$ D3 b; ?3 e4 X) h* J8 u

( |& w" k, W4 Y3 O; k+ `////下面不需改变////////////
9 L; k* m1 g) b- O) Y& m* I1 @- _! i( ]: D1 V6 K
var copyspeed=marqueespeed+ P3 L) g* o9 l4 c) ]: y( Z8 U7 R
var pausespeed=(pauseit==0)? copyspeed: 0! e' ?9 c: w" z& g
var iedom=document.all||document.getElementById7 W+ N( R' i8 B+ g2 C; J$ B
if (iedom)) F0 @5 f& n( `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) r" K) U$ h1 W
var actualwidth=''
5 ]9 m( h; h1 svar cross_marquee, ns_marquee5 N% [7 C, L9 E% D% ^% f
; T" k/ x+ f. B/ ^
function populate(){
% d3 m" e3 S1 C0 L5 hif (iedom){
; X/ {( B( b) L. }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# E0 a) U6 X8 X; _) g
cross_marquee.style.left=marqueewidth+8$ c" L# h) x4 k: ^6 Z7 j* @
cross_marquee.innerHTML=marqueecontent
- B# J5 E3 O  ^1 w' e0 N, \/ p. s6 Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# ]/ `) k& f) ]/ i. [' p" x
}( v/ |) p1 A2 \& z! _% M
else if (document.layers){2 g, M: ?. T  d) ?$ v
ns_marquee=document.ns_marquee.document.ns_marquee2
$ X; ^2 Z5 ]# e2 G3 o) H, cns_marquee.left=marqueewidth+8
1 S( u( J- J' u/ Ans_marquee.document.write(marqueecontent)
) F* }, M' |! P% F8 ^1 ~ns_marquee.document.close()$ n3 X* z; \  G% i9 S
actualwidth=ns_marquee.document.width; ^% W: e. D0 I3 ~3 s1 C
}0 `& f  I! ~- p9 j( H+ M7 r
lefttime=setInterval("scrollmarquee()",20)
. O  j# q9 O8 g. N}- O/ z) k& P- u2 s# M6 K1 z
window.onload=populate
4 X0 d' f$ m% |) }+ t- n2 v' E% _" r# ^6 K$ P$ t; X2 I7 C
function scrollmarquee(){
1 H$ t0 N1 c2 i, sif (iedom){
8 L) ?8 ~3 R/ D2 Q: nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' c4 v' o7 g* Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ Q+ h2 i2 H1 F) g  x
else
6 g5 v. c" t2 w) o# Kcross_marquee.style.left=marqueewidth+8
! M0 l# O2 q6 R" H# P
; i' s- l, N+ h  R; `# y0 v1 u}$ \4 j0 [0 h' i  W# d) M
else if (document.layers){! R2 ~" v4 W! C
if (ns_marquee.left>(actualwidth*(-1)+8))" M& r/ z* V! \+ P; x
ns_marquee.left-=copyspeed% v1 a+ ^3 z* u7 H2 R( w! {4 i
else
1 [0 v6 W6 S+ L0 g5 u% I5 C, g; rns_marquee.left=marqueewidth+8
4 d9 m- n1 P$ J& \}
0 o5 g& k7 k) c}
9 X: W" p2 |. w! ~. |/ R4 L3 v, ^$ ~. |! G* }) D7 c9 y, k
if (iedom||document.layers){5 \4 z' W) V$ c5 F
with (document){6 O6 Z  Z9 v% `- {( m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 d/ n8 C$ G4 V' Pif (iedom){- z4 O+ P( f7 e+ `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  I# a8 d$ A& e' R  nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 C8 K+ U8 i8 T2 u# x+ hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 \$ k# P3 u2 w& }" n
write('</div>')
7 k" t6 r  k4 F: J}( [% f  V- q9 D
else if (document.layers){7 ]9 e+ |; o' d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& d& u# C# n% w; l: u  |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), l& j0 X* j2 o2 ^: w2 A
write('</ilayer>')
/ v* p* t' g  m2 S}' `+ S% G# `) [" F( K
document.write('</td></table>'). W9 k3 D& p, }7 Q3 O
}
( S7 ]6 F0 O0 a}' N- J$ a; `4 x" A- E: e* y
</script>

返回列表
【捌玖网络】已经运行: