返回列表 发帖

网页之跑马灯文字特效

//修改宽度# m5 {' j, K! S( v6 ]! L
var marqueewidth=300  Y+ b  X9 D' d4 o9 m' Q, Q: o
//高度& y- y. c9 m# N" x: i5 n- q: I3 k
var marqueeheight=25+ n& ~4 S$ I7 D/ V6 ]
//速度(1-10)) X7 O0 N0 s& E) _
var marqueespeed=3
* t( m7 X0 K7 n- r# n5 T$ z//背景颜色* l( g) l) S5 v  l- u0 \) f( J
var marqueebgcolor="#FFFFFF"2 M8 c  i2 A. S
//是否能暂停 (0=no. 1=yes)?* k4 y$ W( `% Y2 w
var pauseit=1
- D8 O" ]8 {4 e4 s; ]. b  y7 |1 Y  F9 ~. E0 R, u
//修改显示内容% z1 B+ Q  q* e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 o9 b; T$ n/ L1 W" s

( ]2 i0 w9 A: K1 n8 U( z
6 T: H' O! Z" K' G////下面不需改变////////////, A" C& F. Z6 n

0 j# K- V! Q( z! Ovar copyspeed=marqueespeed
+ T. z4 w$ S+ N9 |9 f$ I7 ivar pausespeed=(pauseit==0)? copyspeed: 0
* U. n/ a7 Q2 ^( S8 s) v, v- Fvar iedom=document.all||document.getElementById
* F, D' x" R5 w3 aif (iedom)0 U' S2 [+ p; |$ V, ?4 G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 k- C+ B1 ]: `% I2 r0 Z3 ~# ]
var actualwidth=''
6 a) y1 Z9 I/ M6 X, i2 Evar cross_marquee, ns_marquee! m! ^: ^& b% e; ~

2 T% K8 S, G" f/ pfunction populate(){
% I, E0 u1 G8 i( a4 y5 @4 X3 cif (iedom){
( T4 I9 ?. A6 L- I8 O. o2 ?2 w# Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ `* F" M! N; U$ E2 {cross_marquee.style.left=marqueewidth+8, n# Y  l8 S) \- D* E0 R
cross_marquee.innerHTML=marqueecontent
- F- S, I" M7 {$ M( y* [# D$ iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 Y2 Q- J* H9 j! i9 W; _7 R}
& m- U* d+ m3 l$ ^5 d& relse if (document.layers){
: A0 M$ A1 g5 @  v; [! Ins_marquee=document.ns_marquee.document.ns_marquee2& [- `) E/ r- d8 P$ G* o
ns_marquee.left=marqueewidth+8
) r% n  y9 |7 J/ N  ~8 D5 |ns_marquee.document.write(marqueecontent)
3 ^) b. ]: x) M0 I* m$ a- b8 ?ns_marquee.document.close()) N9 @7 @2 y( R3 q! @" g* K
actualwidth=ns_marquee.document.width1 v+ C/ ~8 o% H  b4 k- u
}4 y" s8 X+ L9 q% z* e2 d
lefttime=setInterval("scrollmarquee()",20)6 r9 Y6 b. F6 D* g, v9 [$ \
}
7 `$ Y# V4 u) r( M% J; Jwindow.onload=populate
; \4 q+ ]: Y  g' B# R  J7 T9 {- h  o* K2 a1 |9 I2 n
function scrollmarquee(){
/ L: v* ]0 {( R! t, jif (iedom){
# Q+ B5 l8 y- v$ g4 I: U" iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: U4 `0 n+ z+ `" \/ [7 k1 Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" W; p/ t* G$ U2 E' gelse4 `7 F4 R- j1 d% [8 Z
cross_marquee.style.left=marqueewidth+8
' t* |1 R% r6 c) d1 F/ f* |) [! d2 E9 J0 q
}' w' ^  M8 p% i& T" h2 n6 {" S' S
else if (document.layers){
1 @* n9 v% J2 x  b9 @if (ns_marquee.left>(actualwidth*(-1)+8))
8 c9 S3 f) _! wns_marquee.left-=copyspeed
: G, m$ l+ S+ I5 xelse4 X* D; h* i& H; Y  F( S4 u7 r
ns_marquee.left=marqueewidth+8
' X) x' Z: V6 k: f}2 H' E4 S8 ?3 z( \8 S+ l" \6 O
}( l" u$ S6 P3 K

2 c; [4 U3 B5 X% V9 |4 ^if (iedom||document.layers){
! |# K! {1 Y3 g) o% [' bwith (document){, }3 o# W, }  q! e4 W/ q  M  }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 \; U1 L, O- ]( a0 s; R" v+ O
if (iedom){  |) Q& a0 Q% x8 Z6 U! m9 z" s! Y' y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 }4 t$ E+ C" Z/ o5 w, P  y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 [6 ~4 w: q% D- \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 ~, _0 B& A8 E0 a+ A1 b) k3 _6 [write('</div>')3 n% ]2 C( U: P7 T+ ~" f% N
}
( b/ s/ W- C( ^- nelse if (document.layers){
$ E. Y$ E9 e- I9 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 T( B0 L0 ~9 t+ b7 ~6 cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ c* @9 J$ X( V  J3 p6 q& M
write('</ilayer>')
' ]$ g* i% _2 ?$ t# O, Z% P  O3 }}+ j) D! v5 O! p5 ]
document.write('</td></table>'). Y3 e# h1 D: J
}/ L$ O$ N9 t' d' s
}
# P% s+ h0 R3 \</script>

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