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

|
网页之跑马灯文字特效
//修改宽度4 k+ f6 |- j% ^# g7 \
var marqueewidth=300; `- C d3 r# V5 o7 l a
//高度
& [" ]6 L, u1 Q" X Lvar marqueeheight=25
2 `4 E% e5 @2 `7 l# m# Z0 H6 H7 {/ b6 K//速度(1-10)* z1 q; t- N, C) M$ I5 A; W
var marqueespeed=3
5 V8 x. m; T B//背景颜色 N2 i- P5 b3 Y. s2 Q
var marqueebgcolor="#FFFFFF"
0 p4 P' W% K3 i- g1 p) \, w) |//是否能暂停 (0=no. 1=yes)?) e5 }) g% K! Y. C" P# S
var pauseit=1
* ]- T0 F- d2 Y+ \5 Q" j% ^1 a) ]9 H% [5 c9 K, V% Q( f8 c4 ^
//修改显示内容
# K* l% m; ]- M9 e# C D M- G$ pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ T! L. ~- h- h+ a- l1 w( Y% F: r Y. Z2 i/ I4 Y
& w i2 G! |+ ^4 X' d% t////下面不需改变////////////0 g! p. _6 o! ]3 D0 u0 L* C
5 J u/ j( j- y# n6 O+ |var copyspeed=marqueespeed& g+ [) N: Q Q" Y# i
var pausespeed=(pauseit==0)? copyspeed: 0( b6 t$ y. g3 `2 a' X( V
var iedom=document.all||document.getElementById# Q3 v+ B X' p
if (iedom)
% \% ~3 x9 r1 Z* n% y0 {document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 w& e: L2 U( i5 m& D9 G z
var actualwidth=''
* ~3 S+ E$ s/ K- ~$ wvar cross_marquee, ns_marquee, B. _2 g8 _* C+ Q7 g! Y
" U5 W+ b* U$ [ dfunction populate(){1 c* v( z9 @% ~
if (iedom){" R: b9 X' Q' A: H) a/ P5 p" `) ~) ?, z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" {* T7 j0 ^8 w3 L. O/ H
cross_marquee.style.left=marqueewidth+8: U" [& k" `7 T0 H& a- T
cross_marquee.innerHTML=marqueecontent7 g# x* i' n3 @7 G% V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; e/ ?) m9 p: t0 W
}
: S- V; x# e( uelse if (document.layers){
: n& [) v/ w' c( Q+ X; W( `) ins_marquee=document.ns_marquee.document.ns_marquee2. \) w7 X. s# C1 }9 w
ns_marquee.left=marqueewidth+8$ n8 u0 a) E' d& S7 {+ Q
ns_marquee.document.write(marqueecontent)4 `; }# y( y0 z/ G( N7 o& V
ns_marquee.document.close()5 t% @! _/ C7 J. s W. l
actualwidth=ns_marquee.document.width! U$ Q9 X4 \* V5 M7 [4 t; j
}4 }* e7 _5 ~! t7 F+ \, H) a
lefttime=setInterval("scrollmarquee()",20)
! O) v2 Y K. ]& Y}
l) @6 v% l* h( lwindow.onload=populate
4 S9 h2 J# H3 U+ u9 l+ x6 t8 n
6 u# ^) {0 C) I7 `6 Gfunction scrollmarquee(){
' C# p" w: v- M6 i! {7 U2 w' ~if (iedom){# g! |8 l+ V* [ T+ x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 O+ o3 \4 G- l+ R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 M: h2 e, z# Z v! Q
else3 E: e" I* r. W
cross_marquee.style.left=marqueewidth+80 i. S+ K9 L8 j
1 z$ h. N$ `& Z3 _+ Y
}
$ m4 x/ |6 d+ i; b; H- _+ telse if (document.layers){
5 |: ^2 _& O4 `/ @1 U6 B2 Uif (ns_marquee.left>(actualwidth*(-1)+8))2 \8 k6 T- D/ f* b5 S
ns_marquee.left-=copyspeed
1 a _9 Q4 U& kelse
" z" ~9 q/ ~8 b4 d8 kns_marquee.left=marqueewidth+89 {2 T# O0 E% Y' R y) e
}( a% y8 T& \: p4 k" |
}# p4 ?* U0 E( Q& b9 C
; B O6 Q) G5 o1 f' P- V- H
if (iedom||document.layers){
3 b* e1 p. f' k0 o, ]( S+ { Twith (document){
* Y+ V; X9 b- |( R0 w, j* Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 j# b5 M6 `# r0 l( `2 Zif (iedom){/ ~9 s3 v3 B/ {; M# B) I, W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ A7 G) w6 h6 W% k0 {& @& A* P) @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 m k* _' T3 T8 f9 u6 owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) |7 Z. [0 D9 F) O- C! Qwrite('</div>')
+ {- t/ d, A O, W( a}
7 {+ c! |% h9 s- ^$ Q$ P: |; Welse if (document.layers){( `" Q- o. n$ P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), U7 a: u! j2 N! \* t6 |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* L* o1 ?/ e6 Qwrite('</ilayer>')
, G( ?* }. [7 `* h6 Y3 V1 M}. y, c, v$ X, F/ w3 R* F) t4 ?
document.write('</td></table>'), c% M* W/ Z) w0 z5 Y3 b
}
7 c' X, b l9 H% M! v}
( k) x3 Y9 z; X [+ E& o- s</script> |
|