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

|
网页之跑马灯文字特效
//修改宽度; z! ^8 O8 C) ~0 |+ q3 Y
var marqueewidth=300) J- m; `0 `. q& A; s& `' `
//高度% x3 [- V) v5 d
var marqueeheight=25
6 @% K" F5 y8 Y. M8 ?( D//速度(1-10), |6 V% q9 x# Z$ {
var marqueespeed=3
0 E# W% d# ]! ?4 k' n* Y//背景颜色- r3 ]2 }* {; G, w, g# h
var marqueebgcolor="#FFFFFF"
6 x+ C. a; m' F: A/ Q//是否能暂停 (0=no. 1=yes)?) E' k3 _- K" ? Z- K
var pauseit=1
# W2 P' J: E t4 U3 U8 z( I2 u) F+ ]5 E8 v- H$ {
//修改显示内容
\. r4 y+ ^4 Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 q8 i7 w" l+ u/ h# U
" h. X- {& I# M `) D# A/ l5 T1 h$ X6 T3 w
////下面不需改变////////////
& a9 ^/ X3 a' X: x5 L* X4 E$ N1 t j1 U# X T. c( i
var copyspeed=marqueespeed
+ b+ n# f5 u2 Q3 mvar pausespeed=(pauseit==0)? copyspeed: 0
$ a. L, b% u% M4 U# x( u9 M) fvar iedom=document.all||document.getElementById7 R4 F% X, u& Y$ I9 {3 {# z
if (iedom)3 K$ \* Q; b4 g4 J2 x- J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 n1 ^2 v; J# l$ svar actualwidth=''
, B4 @- i0 o Q) d. c/ f @var cross_marquee, ns_marquee; ?# I6 y' {1 c- A2 d7 w
8 t- }) @6 i0 M ~6 _function populate(){
% s8 }1 a* U; |1 Z( tif (iedom){% B( g+ O. u' R; e; j0 r( F7 s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ H0 S4 Q; r d! w) c( n; w+ ]
cross_marquee.style.left=marqueewidth+8+ Q, @) G4 O2 K, G, q3 y
cross_marquee.innerHTML=marqueecontent, C; S V$ g- ^+ i- c* l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( n% M( Q- f- |) f8 y: l}! [5 m' K2 r0 f( P E
else if (document.layers){- x: V1 }2 E' r' {0 _( J0 x6 s
ns_marquee=document.ns_marquee.document.ns_marquee28 W8 s/ R. w) X7 n5 N2 b' ~
ns_marquee.left=marqueewidth+8
7 U7 `" {' A0 D( G' P5 s2 P& ]" yns_marquee.document.write(marqueecontent)
- w& k% W. h9 Y7 L, [% nns_marquee.document.close()
3 |' o& e6 Y. qactualwidth=ns_marquee.document.width' R3 S7 P1 `4 p8 Q' q
}% ]; P' `1 N# T: q h$ Q
lefttime=setInterval("scrollmarquee()",20)
& q4 k1 i# e2 I* t: D( F% e8 P}
5 X* c* ?) f+ s- a! r2 O5 B/ Ywindow.onload=populate8 D" F5 V- C/ e3 Q* Z( b5 w& e `
1 X) j9 _& C/ p. I- n4 }9 ]% v
function scrollmarquee(){
6 j3 o6 i. J5 E- U3 ^% v% J8 V9 ?if (iedom){
6 P4 ^$ ^% z! O( J0 q. Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 L2 r, e0 F5 S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 M1 B! b& ~: F+ W$ J# `; i
else( |' g [: F: ?( q2 @
cross_marquee.style.left=marqueewidth+8
- B$ z& ^3 o; B D( L' S/ A( I9 i& ]- q& B( `# i4 r3 G
}! Z/ F0 c, s, U ]2 N
else if (document.layers){1 B d- }+ D! i
if (ns_marquee.left>(actualwidth*(-1)+8))
5 q+ n! T% t: j, Hns_marquee.left-=copyspeed3 {9 m$ G6 d8 e$ \; }0 X
else: G3 n( |/ H$ h
ns_marquee.left=marqueewidth+8
7 F4 c1 e" T- ` y}
+ V4 \1 T( A* P}; f8 C" E$ r# g
9 @! t0 y7 S+ o' p0 Oif (iedom||document.layers){1 {& g! @/ z ^4 q+ ~* }
with (document){
8 L4 S. v5 R7 e* p& Q4 k" {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ e3 w# L) M; N/ ]% P9 U m' a
if (iedom){
6 h! H b; b+ Y; Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ U8 E: h6 O, D/ X/ C' i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 ]3 q4 j& y8 k$ e8 k( qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); M5 ?" [$ `* d8 A
write('</div>')
; T# d E ?& G- s! z6 k}
' `& V2 X; c) p5 }. V+ Aelse if (document.layers){
. O3 J8 N S6 L. |. [/ A6 Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). D+ O/ s3 Q c" p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% `+ w; \7 J0 J2 u# Mwrite('</ilayer>')
2 S, ]2 a9 l i( ]6 V7 e}0 W1 l0 [8 k9 U/ v4 }
document.write('</td></table>')7 A4 J, O P0 {& G l* k
}+ [6 J2 U" |/ m8 j- j" Q/ h
}
. k1 ~1 z: W g/ {2 H</script> |
|