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

|
网页之跑马灯文字特效
//修改宽度
6 ]6 ~7 \5 u# A7 i" gvar marqueewidth=300
! r# j3 h+ C# X0 P4 v5 T6 s//高度& g5 B. G. j3 R) W% u
var marqueeheight=25
* n! `" s: f5 \: [4 r//速度(1-10): l' h& U7 ]- \7 P- M+ c4 _
var marqueespeed=3& g6 j3 r* h& n J& F
//背景颜色
5 E7 K( i6 b3 Uvar marqueebgcolor="#FFFFFF"; B5 s4 a7 M& z' N4 b. Z, ]/ b
//是否能暂停 (0=no. 1=yes)?2 O9 ]% a( x3 H7 c) ]
var pauseit=1
, _- z3 B: h7 Y% K' u6 F/ z, {) K( L1 f
//修改显示内容
/ I. q9 B: P4 e* n5 Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 ?( ]# q3 w; a; n5 [1 ?; } l* V7 H; U8 }5 j
: O* t: y7 W' C$ n1 A3 P% q+ @
////下面不需改变////////////
- f% Q3 h/ I9 }) x3 h2 b7 ^
" {: A/ z0 a, \var copyspeed=marqueespeed- m* e0 N \" a1 {+ C
var pausespeed=(pauseit==0)? copyspeed: 0% q6 o9 R: C* F6 w. e' V4 I
var iedom=document.all||document.getElementById3 G* @) G: B4 x# A
if (iedom)
( Z0 n% l ^) i7 [! D6 @* @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 O- t7 Z# I: z* e% \/ S7 ?
var actualwidth=''
9 T; K* z5 g: E* m. gvar cross_marquee, ns_marquee2 V4 }/ j% \* I
9 `) c8 S1 u: [' h5 P" k
function populate(){5 z2 r2 |9 ~/ q7 R/ \/ j% T8 q+ t
if (iedom){
1 `6 @1 t( J1 xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% B6 b/ N; N% O4 n* V+ ocross_marquee.style.left=marqueewidth+8
1 g, ]6 r/ s6 f, i2 S' ocross_marquee.innerHTML=marqueecontent
, @$ g# L8 U* U* O9 aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% ?9 d' R& b& r; d& r}
+ Q6 Q2 E; s8 ]9 T; l8 velse if (document.layers){
% h) ^4 s, T) `# Sns_marquee=document.ns_marquee.document.ns_marquee2
C, [# A% C8 ]" X9 Q* Dns_marquee.left=marqueewidth+8
. h# U, X# H! |0 m) ?$ c' Yns_marquee.document.write(marqueecontent)
* s" b( \3 `1 s* X: ?, Pns_marquee.document.close()5 u- |0 x9 P+ F$ _4 Y& e! ` J8 J$ z
actualwidth=ns_marquee.document.width
5 k3 p& I6 |) R! z# h}% u) t$ w$ Z; ~1 @% y5 X" B* v: u6 K# m
lefttime=setInterval("scrollmarquee()",20)
8 }( r, w1 B n2 t7 g; t C/ {} Y( Z, R* U0 G
window.onload=populate
6 T' n! ?7 \' d
, s$ G% H* O' S" x+ d, h+ `function scrollmarquee(){
. a: ^" m" P/ G" S" pif (iedom){
0 h$ P& x% b( f- @! M2 A& Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! u$ i0 F2 @. g1 [) r+ Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 B1 U: a$ V9 x& ]
else6 a- [; d5 N' x- P5 p
cross_marquee.style.left=marqueewidth+8
( U. ~6 Z G/ f! t0 i- E6 @; y' X0 Q& M/ ^! _+ N) Y2 z' c3 w! j
}
. R: Q: i2 s4 H) |1 _else if (document.layers){
1 Q" `1 ~* g% u4 c Jif (ns_marquee.left>(actualwidth*(-1)+8))1 @- k, J8 m( c; ]8 s0 I( q
ns_marquee.left-=copyspeed3 H3 e) C- S3 ^2 `# s v
else; @( _! p% m! j+ [! ?( {' }
ns_marquee.left=marqueewidth+8
" \$ h% U$ t; j4 w}
& v& o2 \. X: G4 u& g2 M3 w* r. C}7 A' Y7 C( d0 f/ @7 |
6 H0 ^& W5 Z) p1 V6 @# h E- ^
if (iedom||document.layers){4 @6 V( l) K' m, b# G2 u9 x* k
with (document){
- A- z- i7 _4 k E8 Q/ hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! p% ?. P. |: S* _. O6 C0 Y! T
if (iedom){
2 w) ?( Y" a# T& I- L. |% f* \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ y5 c0 q p% @3 R+ \) P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 c- M: k% z6 B, Q$ ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% R1 ~5 X! B, b& ~; _ o( E$ }
write('</div>'). l' W3 g4 R+ C: ?" y
}* \6 @7 c* Y7 ^, k$ X2 _1 N
else if (document.layers){
4 t/ Q+ I o$ Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' P0 e) z! g# `( b! [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 z# G$ L; B- @' p w
write('</ilayer>')" W8 Y# W3 w% m& A
}6 X& e7 E$ Q, K6 P8 i% K9 |3 m7 c
document.write('</td></table>')
* E% w2 }( |) m7 i$ L} f4 H- F X( I( ~
}0 o, O+ C. _: r# g' ^; s
</script> |
|