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

|
网页之跑马灯文字特效
//修改宽度: u7 Q: Y; g1 P% _9 p6 h
var marqueewidth=300
# D* |6 e! M: @9 v//高度
3 f5 }; V5 V( T q, @, s* `, Tvar marqueeheight=25
+ r$ N; n! s$ E& N' X& w s//速度(1-10)
, k$ N% C3 k" s9 S8 O4 b& e {8 avar marqueespeed=36 I9 B7 P5 P) m% m0 ^, U
//背景颜色
( L8 ^& R' [+ pvar marqueebgcolor="#FFFFFF", |1 V3 L- I8 {
//是否能暂停 (0=no. 1=yes)?. c; x) J8 c9 g x Y
var pauseit=19 e8 I2 R s" B" c7 U* h( h
) `/ H G8 R/ U/ V% I
//修改显示内容
% a- u& c/ M5 V* E+ \8 F bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' W7 @7 _! p' o* D+ v. Q; @+ {6 N9 ]: o+ S2 G+ Q) i# z
+ g; C. [1 l" I; |; R, J
////下面不需改变////////////
8 K7 |2 T4 x# b3 L5 f. w* P% Y+ F$ n
var copyspeed=marqueespeed' [5 L/ G) @8 M' P1 y
var pausespeed=(pauseit==0)? copyspeed: 0% i7 D8 _4 d% R% |/ v* D& F7 {; S( `
var iedom=document.all||document.getElementById
) v) {% B u: E0 t5 K% N8 v$ Kif (iedom)
4 W0 I, m+ e4 [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
j( `8 J: o: o: }var actualwidth='': P; `1 |0 R) v% H& g$ S
var cross_marquee, ns_marquee" V' Q1 n7 D8 S1 \) l1 s8 B$ f
9 u, L$ j" s C
function populate(){3 v6 K% D: K5 o% ^7 P3 H
if (iedom){
0 X4 C* ], L+ L* C9 ~% ~: i% ~7 Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: ]# T _% k" e- M4 L) Bcross_marquee.style.left=marqueewidth+8
/ h( K& V, c' m" `6 K G- Gcross_marquee.innerHTML=marqueecontent
4 o- w6 U, v! b3 S/ ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, ]( }% Q* t, X6 i/ @% B* L: A}
w2 j9 T) O3 E4 W' L3 Y8 ]* \else if (document.layers){
/ I, P* @. n) u# M d9 Zns_marquee=document.ns_marquee.document.ns_marquee2) ~. H# T6 j: \( r( s, f
ns_marquee.left=marqueewidth+8
) P" d/ i& P: k$ l2 L- e2 V uns_marquee.document.write(marqueecontent)
. j1 ]+ P9 ~, H' X" a4 Gns_marquee.document.close()
# R2 x( Y, @$ Zactualwidth=ns_marquee.document.width
; o7 Q3 t& h4 `9 [/ I0 g0 @0 ?}
( q0 J- T4 R3 \4 _2 elefttime=setInterval("scrollmarquee()",20)$ |, _8 [/ Y! z4 _4 ^
}' v, ]4 q* l7 S: b7 x
window.onload=populate+ c9 `. y0 k9 g o" o
' R" G6 V$ V% N
function scrollmarquee(){; g! ^. i) v2 x/ J
if (iedom){$ g: H X, G2 R( [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ {" X) I7 I. f/ ?0 K. z' mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: m3 s8 u: `: O5 @else
; P9 y, }# c) J* Across_marquee.style.left=marqueewidth+89 }4 o( O$ v9 J9 A6 w- l
* ^* y( y# `( \# E9 A
}
) j. ~. _7 Q# A' o4 Q; Oelse if (document.layers){+ M0 u& [: l: G9 Z: w
if (ns_marquee.left>(actualwidth*(-1)+8))
2 F1 I0 S* r; j5 ]# l$ t* Fns_marquee.left-=copyspeed
# V1 D( j0 b ]4 S [" |) v) ?else1 Y( Z$ B( Y9 |+ B& H+ a0 J' U
ns_marquee.left=marqueewidth+8
. ~! T6 N1 l2 O: ]" d$ E* X} }+ ^% e6 i* S& F2 K1 E
}) g7 m: B! ?" U- B S( J' b4 P: t
- i0 `& ^5 h$ t% b( N! ^: g
if (iedom||document.layers){0 R$ w9 |( y1 \1 l7 N* O1 A B
with (document){( x& I) M- J* }) G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 H$ ~, A# }1 a) Q& f2 w
if (iedom){
s; k, T8 N. R2 Y! }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 g' A% C( x& _ X Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! p; l8 s) W: z- K3 U' i0 Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 x" m% v, j; x1 e6 X6 k# e! n" |3 \, twrite('</div>')
5 q+ k: D/ m% p! J# Y}
$ o j; x/ P: s8 Felse if (document.layers){% s7 T& u$ l. G1 u: P8 {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% u+ ~0 k- ^- ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 ?- d( m0 i. ?6 D9 qwrite('</ilayer>')2 d0 r# l$ ~& m' I+ }2 x
}, W9 y' H$ ^+ ~4 B$ ]
document.write('</td></table>')
; B7 P: @/ Q: T* z, y3 i}! L/ `9 L6 S* T' C) ]/ O
}2 E* `( y# B( n, r% T" o C* M
</script> |
|