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

网页之跑马灯文字特效

//修改宽度) L! }: F( _+ l! z3 h& s
var marqueewidth=300
, W) s' p9 ~9 I//高度
: O, j, W  D1 i2 L6 Wvar marqueeheight=25
, l9 M8 N+ l2 g6 `6 m' K! z//速度(1-10)1 d  ]7 w( y6 d* |6 H
var marqueespeed=39 ~, |  m; Q0 F* X5 C/ U" \) r: Q
//背景颜色4 I- w1 h. k- D% y( x+ }
var marqueebgcolor="#FFFFFF"
* t4 \3 K2 }% p3 u; A$ C" z) E//是否能暂停 (0=no. 1=yes)?
, |2 w/ v; r# _# K  n* \var pauseit=1$ \' S- z. o# j* b% X

: g6 i9 i& ?& \# S//修改显示内容1 |9 A/ e3 U. r. Y' T$ p5 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- v: u/ a% b4 z( `: e2 V% i
" ]8 x5 q* h* j- k/ a* W. }2 ^4 y6 v! C; V; }; ]* w# [( c3 a/ \+ a
////下面不需改变////////////
% v6 o" R% [8 z  V/ I0 ~, D# p
% K& o7 n6 w2 f/ E0 H( ]var copyspeed=marqueespeed
2 j+ R5 i3 |4 y3 V( Z3 X* p5 mvar pausespeed=(pauseit==0)? copyspeed: 02 ^5 h' G8 f4 D4 S/ }2 e
var iedom=document.all||document.getElementById
; a# Y: s) I" Y. Qif (iedom)# V$ U4 ]% f0 |. c6 V  R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) h: r2 h- P# v! ~& ovar actualwidth=''3 S, v( K. q% T) s8 {
var cross_marquee, ns_marquee$ w! ^# X4 d+ ~8 t

0 P0 R5 g" _  c2 Afunction populate(){% J3 c/ B9 U8 f- ^& m/ l, E
if (iedom){
8 t  m; }7 s6 P0 R: u' y% Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( b1 Z: [% Q3 [& V( ~1 [% q3 ~
cross_marquee.style.left=marqueewidth+8+ b* Q  ^+ c3 l. u+ W+ Z
cross_marquee.innerHTML=marqueecontent
# Z, Z# o- b4 _/ Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) g8 f, k/ l' Q) y2 w* I
}
4 Y; O5 u7 i+ N. b1 y/ Z* G+ [8 x4 Uelse if (document.layers){
: _0 s' U+ L( P* p$ Vns_marquee=document.ns_marquee.document.ns_marquee2
" K; |" w# u' S6 c( {. ^ns_marquee.left=marqueewidth+8. L* G& n. K8 y- X8 z( P4 @8 c
ns_marquee.document.write(marqueecontent)8 m& u7 F* Z+ U$ ]& v
ns_marquee.document.close()
7 T* j- |! R1 x- b7 u( [' z) [actualwidth=ns_marquee.document.width8 a6 ~9 J8 \: j8 L9 L# H- }* C& E
}0 e' u5 F' I: B. q0 u' X
lefttime=setInterval("scrollmarquee()",20)
8 v+ l3 x4 m0 J7 s' N. Z}
: S. M- h. \; M7 u; |window.onload=populate( A% }$ B* E" u+ a7 G5 O0 _
; G& z6 J: I7 O/ K
function scrollmarquee(){
( \; V; V, u# [" i* u5 V9 n3 eif (iedom){
; i1 B0 s1 i9 k$ ?* W- f% `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# E8 p( Y5 X, m9 n1 H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  M/ I) B3 u9 o5 y9 e! a
else0 |8 g3 g5 Z& O
cross_marquee.style.left=marqueewidth+87 U* ^* j$ w1 W. }1 [" O

+ i/ t# D- ]% B% ~}7 ?- h$ \4 ^4 T( U
else if (document.layers){8 {) A" w2 M" t3 o+ T7 o, p" [. o
if (ns_marquee.left>(actualwidth*(-1)+8))5 ?4 f8 k+ f# L: j
ns_marquee.left-=copyspeed! m5 n; ^- c4 |7 Q& y/ y' x& Q( H
else, g$ z! B; V1 E7 O9 ?! v9 A; n8 N  Z" E
ns_marquee.left=marqueewidth+8: b* k( G6 L7 V- e
}
# X# U* }6 a8 B' ~}/ Z# A0 w- {% Z3 I' c2 p
4 R4 Q0 X, n( ?9 t6 O
if (iedom||document.layers){# A$ n. L4 C0 V/ R4 u% u9 m- i0 ?
with (document){
+ t* l: Y! Q8 n) a2 e- Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). I7 B# _4 C0 o6 s$ w2 X$ S  M
if (iedom){* [9 b1 e+ X, o2 I' G/ l( V6 M, e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ e9 [/ N3 S( `& t8 s  ^- @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' n" C" g8 P6 X7 t3 d% ?4 `8 ]/ vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 n, m+ \' y/ P0 ]write('</div>')
% u* U6 w: V6 q) ^}! X0 A) w: a" [$ r% p& v; y; z
else if (document.layers){" M3 ?4 s/ Y4 ^5 f( T" a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' G1 r, z3 j7 S: i1 m* O% S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" U9 z& q* ?# k, L! z" @+ p+ o( k! a
write('</ilayer>')* K" S5 O3 u8 m* @$ E7 V; l
}( A6 a& X$ b: Y2 g! N4 ]8 p
document.write('</td></table>')0 \* s; X4 _) H
}; h! V/ E' Q# p* [. w3 G* ^8 t, g
}
2 ?2 G+ |% g9 {7 u* u3 G</script>

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