返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 B! p4 S" n9 ]9 i  }) Cvar marqueewidth=300: _3 a; k: K, e7 F& {6 n" L
//高度" e( F& T, p- ~' W. R+ O1 D
var marqueeheight=25
+ ^3 s5 `, o5 v3 g. B//速度(1-10)
9 j1 F7 _5 N  q; L  M  avar marqueespeed=3
, s9 f: m1 k. ]2 S# E) [6 ?6 v; c0 D//背景颜色
' T. ]+ n8 u% |) Xvar marqueebgcolor="#FFFFFF"
! U9 Y8 `9 z3 @$ p# Y//是否能暂停 (0=no. 1=yes)?0 j# D% E+ J$ w& [: p8 ?: I' L8 Z2 V
var pauseit=1/ N3 n1 S, w3 t) l6 x
3 U7 P" A) z0 f3 m2 Q. t
//修改显示内容
% x! E# H- P4 R9 ]( t( ^4 Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 C* Z+ m8 L2 a5 K" l0 H& g$ j( [! m- v) s
+ D" m7 ]& b, ^+ j& j
////下面不需改变////////////
5 z- q2 H! }2 I8 u1 a
/ O0 l9 Z  F) k6 M# p+ o: x: {0 Cvar copyspeed=marqueespeed1 I! L1 T7 C# [+ K
var pausespeed=(pauseit==0)? copyspeed: 0
, Z" F8 {8 L' Fvar iedom=document.all||document.getElementById
3 s$ v' s3 c/ |+ \if (iedom)
# w) C" |) z6 \( m% ~4 o) g, Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): J, T/ N) D3 h+ U: T; h; [
var actualwidth=''
2 L: @( b' d# T7 Fvar cross_marquee, ns_marquee) k5 o! I( f2 R1 g9 E. ?  y
+ s9 W' r! n! w) G& ^7 E
function populate(){+ b# t. R- c. R$ B# F8 q3 |2 J4 l2 \
if (iedom){% Z: f, @0 |9 L! R, {% ^7 H% E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 y" e" B* ~% m) s  x7 m9 O
cross_marquee.style.left=marqueewidth+8; t3 o. x1 R1 S' O* {
cross_marquee.innerHTML=marqueecontent
3 I. u9 G- d" cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, W- ?* W' d7 z& d. i4 G
}
) ]2 Q9 d6 g3 w. eelse if (document.layers){
' r6 W/ R, Y" m' t, B+ nns_marquee=document.ns_marquee.document.ns_marquee2
* n- Y3 w  j  \( b% P# L( ]ns_marquee.left=marqueewidth+8
5 K% \: x6 e5 D2 D1 m$ q- dns_marquee.document.write(marqueecontent)+ A" t, W% C8 T& s6 G+ u, V
ns_marquee.document.close()
" ?0 i+ l2 L2 ~0 ^5 O' sactualwidth=ns_marquee.document.width
7 I( {8 T* \/ z3 ^( P}5 n  Q6 p2 p3 o4 ]
lefttime=setInterval("scrollmarquee()",20)
/ k; v9 U) A$ r, R# ~5 `- m}- S, S2 N% f2 S4 p+ T! U# c
window.onload=populate1 M: p6 }4 b( p! @; M. q

/ a0 C( G0 q1 P2 H% a* Lfunction scrollmarquee(){
, C# ?$ X7 w- n7 z* c- O% iif (iedom){
) [5 F4 I! o0 [. h) D; t9 }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 |- S2 v- |' g/ H+ b7 E% N; f' Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ i3 b6 i' a3 ^# selse
: Y) g3 Y, y2 ^2 q& ^cross_marquee.style.left=marqueewidth+8/ o1 Z7 K: \* ^3 n: _- s$ J

8 W  g1 w/ j, F}
6 ?3 s* M1 e: b  J# ]else if (document.layers){- D8 T* B9 U* L% N
if (ns_marquee.left>(actualwidth*(-1)+8))9 t) |# t+ w! B' H0 q  U
ns_marquee.left-=copyspeed" _. y: T, w5 ?
else
& k# Q! l) f% P& i% ins_marquee.left=marqueewidth+8
. D$ g9 [2 V) {}6 p7 N2 x2 d: G; A5 m: P
}% S; P' J' @3 m7 ?6 U4 q9 ?* x* c9 l
( q9 v3 N% ^$ W1 q! K
if (iedom||document.layers){
. O3 {3 t! F) {- e; ?with (document){
! |+ J; r* ]0 d# V4 z* |2 L6 s7 edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( }8 i) }( a: d& sif (iedom){" V: Z* H! T* N/ Q' m" Q) j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); `) N5 C1 e: `! r. s* b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# E8 v2 _% }$ [( ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 @3 h8 b8 C( o% m) ?! g* j3 v
write('</div>')
/ f0 ?9 T' x/ I, u/ V+ H% L" ^}- a/ J" h- a0 W9 E& @
else if (document.layers){+ [: a. w1 P; }$ j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 }: E- w/ d1 Z9 Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 r3 a+ w& U+ d
write('</ilayer>')2 i; ~: C7 ?, c" i
}9 c$ U& c* K  j6 {& p
document.write('</td></table>')- }2 [: }7 A  f8 v
}; x2 }, q: a* u, i# c( _3 O
}
% V& R  t- P3 Z+ h/ N( U</script>

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