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

|
网页之跑马灯文字特效
//修改宽度
% r8 F/ q. R U7 d, G3 s! Wvar marqueewidth=300
7 S5 u. }0 R4 j7 e//高度
a3 H; C+ o4 {3 g. Rvar marqueeheight=25
& u! ^& Z9 r0 G- I9 E, Q3 C+ l4 I//速度(1-10)+ U0 s* F: }; S$ ~5 ]8 V
var marqueespeed=39 X7 p3 Q$ G. @# D8 y
//背景颜色8 S' g" \5 P2 ?$ B+ W0 @1 Y
var marqueebgcolor="#FFFFFF"
2 H5 ^3 M ^/ Q8 S- D//是否能暂停 (0=no. 1=yes)?
6 A, l/ I5 I# I* x% v6 Y* Vvar pauseit=1
1 C: m# \" H4 I6 m% f" E
# z& i" x7 w5 p" f, Y9 L: [, Y" c//修改显示内容
) z+ @9 y0 E& E7 K: E/ Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 W5 F8 O! M% \
5 F+ l4 c! h5 X1 t/ j% T. h, S6 t/ i. i
////下面不需改变////////////
0 b. t/ _. w2 h& o4 G+ a0 u. x9 m* w! s& N; L
var copyspeed=marqueespeed& N; u: M" L+ o2 _' J
var pausespeed=(pauseit==0)? copyspeed: 0
) [# o4 D! K5 r( I% rvar iedom=document.all||document.getElementById
F5 C: _/ N, {! P" mif (iedom)
! b$ K; q, S+ Y; _4 M* d# hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 I9 { `4 q* x3 M( d1 J; j5 z( wvar actualwidth=''" H+ I7 m, T# w& m
var cross_marquee, ns_marquee5 T- z) S& G$ n5 J |
3 R% H. o4 G3 K j# {7 w/ E
function populate(){
" G( r `/ O6 B* L( Y4 Vif (iedom){' S0 J% `% K$ {5 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ M$ w) w1 z$ F+ [ ucross_marquee.style.left=marqueewidth+81 T# h: w: M5 {9 u2 W+ C
cross_marquee.innerHTML=marqueecontent* @: ?6 q: P& g& @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 _) N, g* X6 _, z+ ]& s3 B# w}: ]2 N$ [3 Z3 i" i" r$ ~. v
else if (document.layers){7 B5 ?- c* ]& V
ns_marquee=document.ns_marquee.document.ns_marquee27 _" X4 c/ s2 P! W3 _
ns_marquee.left=marqueewidth+8
' Q5 Y( X0 {9 I) a( E$ T* Fns_marquee.document.write(marqueecontent)2 B! s( r- S+ {) d/ {+ n# n
ns_marquee.document.close()
& b! A9 V; Q5 t0 T0 t( L& factualwidth=ns_marquee.document.width8 @8 P# w2 s6 o) [ S
}
8 `+ Q; @. k# ulefttime=setInterval("scrollmarquee()",20)
5 ]( G* |4 M" A3 {# ^, M}0 g/ `' A6 F0 I6 w- B) T
window.onload=populate; Q9 C5 P$ P+ }2 k7 X$ E3 m
' A" T9 e7 c) `: F- ]function scrollmarquee(){
' ]% J2 ?2 k" j1 zif (iedom){. O# U& ]: b) W4 Q. Z0 q6 U1 }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 N; i, m# W9 {5 @3 v) _% f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 l: Y/ J9 f1 J, I9 f) f7 V# m
else
8 F8 Q, E- [2 l. c: [cross_marquee.style.left=marqueewidth+8" ?4 g' X9 U e4 Q2 m8 \! k
2 _, L6 F# D7 u1 N( ?) E}
& d& [6 @$ ]- A( Y% g c7 a- X1 Uelse if (document.layers){
0 M2 `/ }8 o/ f, t8 j; C1 f; Q# M- Bif (ns_marquee.left>(actualwidth*(-1)+8))
2 a; Z2 X, p4 t0 R& Q; Uns_marquee.left-=copyspeed$ U: Y0 n* \" W2 y. K
else d. n* w/ U0 r* S2 |9 N
ns_marquee.left=marqueewidth+8
, K$ x2 `! }6 ?! K}. e$ j( Z! k% C" V% q
}
1 ^4 J8 J1 n% h
$ Z# I/ P- ]! Y h+ q7 d* vif (iedom||document.layers){
$ R7 I3 M: b& E+ e' x) Mwith (document){
, x! X5 o5 e/ ] m& }9 L( Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). |5 m1 i% F$ g8 z6 J! r G! g
if (iedom){
, ^7 m, q% P8 j0 d* j3 pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 S4 c8 z: E8 E3 r1 D) Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) ~- F8 N2 c6 j, Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 a8 c2 X& g2 j- \
write('</div>')% B7 _" U3 ~* { N: E
}
" a, x& n& e" p+ Zelse if (document.layers){; k8 d$ F) N7 w* i0 H: i1 z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- D% d( \8 X$ E' }# Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ L& ?* R9 A9 u! P; u! A
write('</ilayer>')# E8 k7 `7 ?& x1 _% K' y8 x2 B
}
5 F- S0 ?" C0 udocument.write('</td></table>'): e0 i9 g9 d( Z! ^5 h" S! B
}
" C5 ?- \/ O6 H( N# H9 p" J}+ Z. F& d3 [2 e9 {0 I! I. h4 c* A
</script> |
|