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

|
网页之跑马灯文字特效
//修改宽度
* E7 W0 O% s6 y( a6 X/ k* ?2 lvar marqueewidth=300
+ L# @# |6 R6 t* `$ Y# O( q" h3 v0 d//高度- B( H! u5 h/ ^
var marqueeheight=256 G9 ]" ]) k1 r% R- [+ |3 Z
//速度(1-10)' V4 f9 F* H% j$ d8 |1 J. w! X' g/ F
var marqueespeed=3 ]2 g6 ?. V% ?, \' L
//背景颜色1 L% G8 ` z4 A* E
var marqueebgcolor="#FFFFFF"
. t! P" ]3 ~6 K//是否能暂停 (0=no. 1=yes)?
2 C5 n: x8 y9 Svar pauseit=1/ H8 J9 O) W" k, p @) H3 g
4 _! j1 i$ H1 u1 T( f4 W' m" }. h//修改显示内容- c0 {9 F3 P9 J8 I/ {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 g8 o- v6 i: a9 n* F5 p& b: \- P2 N7 n, \
2 r) L* w; `, M////下面不需改变////////////7 A6 M$ d) w! D8 ], b" V4 t
5 n3 ^& P: |% Nvar copyspeed=marqueespeed/ U: r/ D! A; }6 q# C
var pausespeed=(pauseit==0)? copyspeed: 0
5 |- x7 O( e0 p1 z& K3 \8 Mvar iedom=document.all||document.getElementById
. R! m# w" t8 u; ]* rif (iedom)) } F Q/ [# {+ Q; C$ y5 S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% q& b4 Z5 ?; z: Dvar actualwidth=''
I8 Z( [ A* m Fvar cross_marquee, ns_marquee
' l8 ?: {$ z o* X5 _- ]4 D$ z1 D3 V! x" h6 c
function populate(){
6 X5 e' \0 f' V/ K! w5 T4 S5 j6 tif (iedom){
0 g* x* E% Z, U" I4 Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 x1 ~# |2 m, z; z& A( J- v" fcross_marquee.style.left=marqueewidth+8
: t, D) L/ Z, H& H5 W& e, kcross_marquee.innerHTML=marqueecontent
" |% z) K! E) x {. Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& W' d2 i9 U% B. |. Z9 Q}
) [0 K; \) E, V. W" }4 l0 Xelse if (document.layers){1 p2 ?" ]1 ]& f/ s4 X( U
ns_marquee=document.ns_marquee.document.ns_marquee29 D& u' w2 E$ L9 k& K5 l s
ns_marquee.left=marqueewidth+8
# [4 m; Z5 D0 M7 }4 gns_marquee.document.write(marqueecontent)
; |0 V) L9 k f+ Fns_marquee.document.close()5 Z# C# h4 s* b& {9 j
actualwidth=ns_marquee.document.width9 X) y( d, @% V% f% t+ x2 M
}
( M0 W: o: q; A8 \5 G4 w9 Plefttime=setInterval("scrollmarquee()",20)
X& U/ [4 v# _$ o}' Q: W( A; v" t
window.onload=populate
% y g/ M7 V: M9 J+ F
* p2 E- a/ _1 Y2 A) `- |9 n' `function scrollmarquee(){
- s7 q4 x2 o! Q9 Uif (iedom){# M2 k) ~+ a# L& Y o" y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( F$ O! }' }/ S* d& [1 J) ]: l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# q* `% z6 |1 K9 V3 Aelse
" S, g0 u+ e! U8 _6 D2 ~cross_marquee.style.left=marqueewidth+8' X' y K7 A6 j4 N) \7 D# S0 R
9 u3 N1 U) R' i( V
}
K" A' `7 u7 e; j# T$ \1 p( @else if (document.layers){
5 I2 v4 p+ j: T" x, I v6 Tif (ns_marquee.left>(actualwidth*(-1)+8)), ~, m% Z2 [/ u* o
ns_marquee.left-=copyspeed
3 {) z# T) y0 t6 ~) ]* \else$ q8 N/ q( I) D; {( H F
ns_marquee.left=marqueewidth+8
( k, }6 e( D! z/ o# V+ Z% ?3 \}0 x7 P+ h8 Q% ~' B
}; g* a/ }% q( X7 U
) I, }! W' L; b# p' C& D% i' a
if (iedom||document.layers){
; W' F& e/ G- i5 g6 g/ U. dwith (document){3 N* b+ I" h* C' J6 m, E T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% g' ~, a9 a9 U+ x, m7 i
if (iedom){
0 s7 _; `$ y7 @0 c4 v7 K& N& }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- {" z% `* t( t! C- |3 Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 b+ D0 i6 g! D7 P. u* v/ Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* i2 L1 A" u4 S& i
write('</div>')9 m* @& a C) L v$ Y- C
}- V: Q; h: _9 t5 x* o6 N$ K% |
else if (document.layers){
, s( u l$ Z2 Z# dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 i. ~/ r; [8 L2 b8 N6 i' i; S7 `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 C( s3 X4 V8 a
write('</ilayer>')1 R5 ]/ y) }- O& c6 ]! \7 Q2 W
}7 }; `5 o" t2 t; \+ \2 Z2 b2 R
document.write('</td></table>')* k1 m5 A/ L; v V& u: y r$ y
}4 E% r6 @/ }% B( G+ x- }
}
; V9 I$ n ]$ H8 n8 j</script> |
|