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

|
网页之跑马灯文字特效
//修改宽度) f7 R- e0 O/ I: n! t6 s
var marqueewidth=3001 N U$ C2 r% M+ J$ n" z, r3 U
//高度
2 L' I6 v `6 bvar marqueeheight=25- J* U: W, `$ B6 k: B& o
//速度(1-10)
0 D; F1 i& y: F9 Y; Wvar marqueespeed=3+ y7 o9 _1 [7 M+ s
//背景颜色
V- ~6 n9 }2 T$ n* ~# Tvar marqueebgcolor="#FFFFFF"
; ^8 e. q1 R& Q" \. U//是否能暂停 (0=no. 1=yes)?
: l; J7 d, I8 v, [8 A5 S, i+ avar pauseit=1
, ]2 b2 I1 z. ]/ f" ?' H& J) h
0 a/ K; L; O! P//修改显示内容- h2 Q+ Y* o$ {' T3 _5 f# ]6 e2 ^1 b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( B/ D1 d$ w$ l3 Z
- p3 Q5 g& J9 l' H
, J$ H0 W/ f0 A$ G7 s2 e////下面不需改变////////////
- y. K3 C4 Z7 r1 {9 @- W- ^; E7 Y% W& b/ C% R- i
var copyspeed=marqueespeed
5 ~$ A# w6 p) I' g; U2 O: e, G9 G" Fvar pausespeed=(pauseit==0)? copyspeed: 0: _+ y: k8 \! j2 Y7 K, }
var iedom=document.all||document.getElementById
0 q: v0 X0 |( Cif (iedom)
8 E$ r4 E' Y* `& \- W4 ]$ A) c; l8 w, Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 ~6 H+ ?; O- m7 g4 a' B! {7 }
var actualwidth=''7 j5 g& \1 ?2 T! X- t; B X4 \. m# ]
var cross_marquee, ns_marquee
' t9 `# a) N- t y9 c0 X P, L
4 g5 s- U" b g5 P9 j# A% E3 ^function populate(){# u2 }7 G- ^6 f- P
if (iedom){% I8 a' ]8 Y) }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" [/ I8 c. y1 N+ c8 p gcross_marquee.style.left=marqueewidth+8& D/ K7 A" W7 Z8 Q, i
cross_marquee.innerHTML=marqueecontent
6 I0 Z3 ^' _* a8 K' q2 Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! S( ~, O) z) r1 W% ~# u2 ?+ j7 }9 \* f}
: l5 j7 Q/ r6 i8 y% Relse if (document.layers){
* H6 R0 N; _$ E: ins_marquee=document.ns_marquee.document.ns_marquee2! h5 f- o; P5 X5 h* t' o: G
ns_marquee.left=marqueewidth+8
6 r H n, M) v$ Fns_marquee.document.write(marqueecontent)
( Y. E4 c' X- e6 S1 R K3 ?1 r) R) gns_marquee.document.close(): R& j/ a8 ^* d) T0 N' z, e7 `3 \; ~2 w
actualwidth=ns_marquee.document.width
( j3 X9 G1 y5 g3 g! c1 a4 u. H}
( c1 t; S# z9 @8 }- K9 Slefttime=setInterval("scrollmarquee()",20): b. ]/ q0 B4 u* e# s% Q6 a. n& u" J
}8 i: A4 O3 o4 Q3 a8 v2 X1 R' `
window.onload=populate
$ _/ u+ c q& T) k6 ? |1 A8 v6 ~
8 l' x) c& i8 r! r6 _function scrollmarquee(){
9 }" d' h! X- ]if (iedom){
! ~7 c2 b! n: I1 {$ w% Q' k* [7 qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 |5 x$ i2 G0 B8 f; icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" r6 N f7 m, G) @else' u$ k0 R; ?; I& q* U' B
cross_marquee.style.left=marqueewidth+86 C* p$ F( a" V0 K- g; B; D t
7 o" M& L) k2 u: c$ [}
! e3 J. h7 }* B& n8 y* a) telse if (document.layers){
# f( c4 D% F5 C: [if (ns_marquee.left>(actualwidth*(-1)+8))
8 ]- Q" {, X. ^: S3 ^/ t3 }) v( ^$ ons_marquee.left-=copyspeed7 W0 ~7 B/ N/ C/ \: H' }
else, h* g- H% u/ t) m- h
ns_marquee.left=marqueewidth+8- P; b6 j6 g3 B; R
}$ j$ P o* i/ u& S Y
}+ I2 z/ Q( I! D4 c- x; X9 W9 s
E& S! o7 O' X- { M
if (iedom||document.layers){
7 P T# [$ }# c$ A) |8 Q$ v7 {with (document){
! Z$ x1 i( m+ r7 Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 I) d6 l- w9 G; O+ jif (iedom){5 c. A" a% Y+ S3 J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). o) m; H3 J$ T& H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' V! y' J% V( X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* j% s$ g4 }" k/ _% ^7 e' [
write('</div>')
( K$ |" ~. H6 X6 f) r( [6 ]}
% K; [) ?; O/ N( q8 ?% y- gelse if (document.layers){
: s4 p6 H8 @$ r0 C% mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: e; X. t' G4 B1 t2 R# cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 B1 O1 ~9 y- O# E, z/ u c
write('</ilayer>')8 i7 {4 Z F% u" d1 h
}
# }4 q4 e, {3 O& Xdocument.write('</td></table>')
. c' N0 d, j& W# w5 n) M}! a: \; q* n j5 J( J, s" r, P2 l
}
$ X5 K$ [! M5 g' Q* Q# T" N% a</script> |
|