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

|
网页之跑马灯文字特效
//修改宽度 f" k; q6 [& W+ _
var marqueewidth=300
) _* s0 |7 K& J6 D7 i//高度7 T8 r% r" `, b
var marqueeheight=25
9 b" O% ]; O% a9 r2 _: d//速度(1-10)
( o! w3 m4 h5 c( r1 W5 G3 Jvar marqueespeed=3
: F$ g- I# k7 A5 Q. X. d2 q% _//背景颜色3 {2 z1 D- x# n
var marqueebgcolor="#FFFFFF"% O) J; ~3 b6 D$ p3 k
//是否能暂停 (0=no. 1=yes)?
- Z) ?8 k' [* l: F% gvar pauseit=1$ Y2 F A# T% S3 Z/ n
j4 }! t% {8 r1 w7 L
//修改显示内容; Y! J/ n6 z3 N5 t) `: e7 Y2 h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# k+ `+ s) n6 Y( y$ P# U
3 i r& G1 {" o' d7 k( M/ f4 |7 ?( s; j' c
////下面不需改变//////////// o& Y4 r# D# x* l/ X. n4 t2 J5 M
, \4 x8 ]# S/ S& T5 uvar copyspeed=marqueespeed
" R; E+ s, b" R. G- M+ Ivar pausespeed=(pauseit==0)? copyspeed: 0. _* h- d# t% `; `5 q# w
var iedom=document.all||document.getElementById/ V5 ?1 D" ?/ x: Z
if (iedom)
9 G* A) y" y4 o5 k- k$ V2 Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: ~: \! H$ \; N ~7 `* Dvar actualwidth=''9 J7 y3 A4 `: S
var cross_marquee, ns_marquee
# s. c4 E/ J5 ?8 u$ M6 f+ J V! ?0 r
/ A9 Q8 L% t5 N+ Sfunction populate(){8 s( o6 T) F1 b) S
if (iedom){2 c0 i( X/ @% p; l$ V* m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 D5 A' p( j1 Y6 u A) S1 F
cross_marquee.style.left=marqueewidth+8
. H- Z6 `+ W6 N1 u1 x% K- ecross_marquee.innerHTML=marqueecontent
! }, x& H2 f" }* h) {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. e1 I k8 j; f& j9 {2 |3 U6 P7 ?}4 `' s" |( F8 c+ {5 h3 S9 D
else if (document.layers){
' v0 m0 B! |/ Q% H1 D8 J9 zns_marquee=document.ns_marquee.document.ns_marquee2' X, U8 t! m# q3 r
ns_marquee.left=marqueewidth+8! V! ?* l6 }) c& s; Y7 \, Y
ns_marquee.document.write(marqueecontent)
% ?2 D1 K! B3 s! ons_marquee.document.close()% [ M( \& D7 x. `0 S
actualwidth=ns_marquee.document.width
9 l& U* d! r$ {3 T j}& T- p2 M4 i+ l
lefttime=setInterval("scrollmarquee()",20)" v/ s4 E5 ]: G/ z9 X
}. n+ }- A$ a: S
window.onload=populate
2 o$ W+ L: G5 j: U/ F% y; e- v! Y0 L+ b* t, d% Q6 u
function scrollmarquee(){, Z0 y5 e- U- t3 E
if (iedom){
/ R! L% d L( iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
J! \! p0 B0 s# M( ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, ]2 s" c4 P0 t# X' S
else' G9 n. _6 e6 d- r. n$ X
cross_marquee.style.left=marqueewidth+8
+ c+ c7 u- E! k3 R
+ E2 i) X Y* M4 p5 k$ g' i" G}
, v1 A5 p( M/ t, N; x3 |else if (document.layers){
1 g6 i( s6 d) D5 B7 Jif (ns_marquee.left>(actualwidth*(-1)+8))! J% Z( X7 ~7 L
ns_marquee.left-=copyspeed
- v0 D" d9 F h) w. O# v5 ^else
! z0 A( q0 k$ z$ x* {& Wns_marquee.left=marqueewidth+8" s, ~$ Z$ B0 `% ?& K$ [
}
* P9 O2 E' t& k% e}; K& s( }& X7 I3 K3 q
5 ^% W$ J5 R6 Z0 k
if (iedom||document.layers){; {1 a1 @2 Z% [& `" s
with (document){
" Q( ]5 f' J+ j K# F9 ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 s8 A8 P0 x3 \
if (iedom){
) w/ v9 i9 n! V4 `1 y3 s5 O3 awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( o$ h" K2 [) w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% c4 x+ w0 s O/ nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: g7 E! h# Z! o/ M2 u5 Qwrite('</div>')
5 r, s7 x. @" R* {8 q# b' M}6 V4 @2 ?# s$ n5 p
else if (document.layers){* ~8 V+ c/ a8 R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# G2 ]; J8 e1 ?- f+ u0 N* ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# c7 q, J( G/ l6 Qwrite('</ilayer>')5 e. {( W9 ?+ R ?& u& C- y
}. I; E' S+ {3 J/ [+ w/ m2 r0 u
document.write('</td></table>')
+ ~: }7 K$ j4 X- F1 E' E8 m}
) x) _4 A6 x. V4 y2 j- ?( j- L}* {1 {* l6 ?1 H) ?
</script> |
|