Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度% m$ N3 @' Q2 K6 T( I
var marqueewidth=300
. g( O/ w. _  L$ H5 T- k' q0 T: [//高度
3 ?* t" ], r3 d7 d  l. uvar marqueeheight=25
9 X, q* D7 n; t0 ]! X1 X. K//速度(1-10)
) M( T8 t9 ]+ \) A) D. x2 m" jvar marqueespeed=34 F/ f! M& V) J6 k( O
//背景颜色
9 L9 O* B  B7 F4 {* avar marqueebgcolor="#FFFFFF"
( o+ T, A# V5 M( F# h: }) e//是否能暂停 (0=no. 1=yes)?0 X+ f4 a8 }& q- }5 N8 W
var pauseit=1* Z/ M) `6 {' S1 Z9 f; j2 h2 D0 j
% \( i+ w$ Z" o. D! d& o
//修改显示内容7 `. R  l8 c$ p+ U9 n7 Y" _6 Y1 {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( J& M$ c5 @1 D# ^4 g

+ r0 o* ?, s- W% Z- ?" e  f1 \, T& t+ _2 R
////下面不需改变////////////2 C1 o: W3 T4 C* V+ g& h

% ?( V: m( v" H6 P7 ~( D0 M2 bvar copyspeed=marqueespeed
3 u6 H, a0 s9 q( d5 R; Xvar pausespeed=(pauseit==0)? copyspeed: 02 V1 ^- }! W& v* p# Y4 B9 B
var iedom=document.all||document.getElementById
. g1 U8 C! I! f/ eif (iedom)
) P$ q& m8 G; N; Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 v4 f" \5 f$ {% K2 I% d: Hvar actualwidth=''
; q5 B( \. W* H3 v; ?4 {var cross_marquee, ns_marquee( _- E! \: I- [: V+ k- a/ }, E
" _) U" F' _# H0 W  M. H
function populate(){" S6 b8 C8 O+ w6 ]) Z
if (iedom){% g9 G: i% d- j9 r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 O/ Y% u$ V/ |1 c- K* ecross_marquee.style.left=marqueewidth+8
, d$ A% v! W7 ?  E7 B7 o4 ]# Zcross_marquee.innerHTML=marqueecontent+ L, |' D7 e' c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- C* b8 ^' ~) q) S* x' A' x}
  r+ m& [" X' i0 M+ p$ eelse if (document.layers){( L6 e2 r) M5 ?7 u  S! \+ U2 A
ns_marquee=document.ns_marquee.document.ns_marquee2
7 v: d5 h0 N6 p+ z+ t' Ons_marquee.left=marqueewidth+8$ b" O$ {5 Z$ F  {+ B% v
ns_marquee.document.write(marqueecontent)& I) {  o; j+ f+ \1 U+ f
ns_marquee.document.close()
; R& W( W  t4 k. factualwidth=ns_marquee.document.width
, V; B7 A/ P$ Y( l1 T}
  Y+ j/ m( V, }( ^" Zlefttime=setInterval("scrollmarquee()",20)
& o- c9 f1 J* a. h}
: R3 q/ ]& I/ H  U' w( iwindow.onload=populate: C0 x6 m3 b2 b/ N: u

* K+ E% f; f9 a8 efunction scrollmarquee(){
" ^5 y6 o- R! v* M4 A- Z2 _if (iedom){; _" F& y, R4 _& @+ I9 \6 k& M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ ^5 b9 y5 d2 F/ n# y, t; p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, ^( {) ^" S4 f7 [( m, Y4 ^# Jelse5 G) u; z1 y0 I; w0 a, A1 ]
cross_marquee.style.left=marqueewidth+82 V2 K& O0 S7 o# g/ |, \! {2 j

; Y6 ~, ^/ `9 u/ s" M}: ?2 h0 s* m) ^5 R4 ~7 ]
else if (document.layers){
7 J2 w, i2 a7 cif (ns_marquee.left>(actualwidth*(-1)+8))
6 T0 I5 Y- y. q: s" \ns_marquee.left-=copyspeed
* q' r7 }) z& y2 melse
8 Z: O0 `8 Q- y2 |; `4 w* _" g# V- q* \ns_marquee.left=marqueewidth+8; W5 x4 D/ ~# B/ n- C0 k
}
8 G, d& Y0 ], Y* u+ e  T}
+ H# H. \9 z% n3 F/ F1 d, _; E, a1 t/ a0 h- |
if (iedom||document.layers){
# y( I& r2 _( H' L# \with (document){$ b3 P. f; d9 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 W0 @! j* Q4 d+ g6 [* G
if (iedom){  O( o- B& V! X( R. S* a3 g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) |" g! B& a9 {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). s; n( ]2 {! R/ i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% a( E, J9 e! f4 a1 o% ?: c. twrite('</div>')& M& m3 s2 c$ J8 G: ], i3 ~$ Y
}
& x1 e  b1 o4 D8 melse if (document.layers){: J' B4 m1 P2 w' V- z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( g4 ?7 y% \' r7 G, \2 o5 _1 |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& q" s8 \( h( [6 Pwrite('</ilayer>')
! _; L8 a* }4 q+ f- k( v( Y}
' U5 {3 O& C/ [* edocument.write('</td></table>')
3 J% p3 ]( ~, n( g, i}9 m) {& t* o) H, `3 n/ Q- q; d
}
6 B! k  W9 R; r& ~& C4 C% y</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2