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

|
网页之跑马灯文字特效
//修改宽度
# S* q; ?9 x# ~ D/ U! S8 z) K2 Rvar marqueewidth=300
$ W# O1 F/ m2 ?5 b% }: P//高度
" U4 d |- |' Y' U8 Tvar marqueeheight=25+ ?& o& x \$ ?1 z6 W: b0 G4 l/ [
//速度(1-10)
; a6 r9 V: P$ Y1 qvar marqueespeed=3
' J! E! B3 n- p6 r* ?% w//背景颜色
" g. N8 V/ F+ b! @: Y: @# Kvar marqueebgcolor="#FFFFFF"
) I( [4 c- f0 T1 K, \//是否能暂停 (0=no. 1=yes)?
- D$ a. h. c1 w g K! x5 jvar pauseit=1. Z; C2 r8 U; j
# ]& b4 w5 A4 ^6 t) I//修改显示内容/ j2 `. D9 B6 j( |+ Z1 g5 Q9 L5 v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 {+ P8 M. V* {
4 A# X( |. a7 M4 F i+ |
' t& s4 @5 W+ k: s" K; t0 t
////下面不需改变////////////
' w+ T0 w, Y* j8 A5 ?8 i$ i- F* U( P) T: O5 C- C
var copyspeed=marqueespeed
7 }8 \3 P2 w: i6 \! m3 g8 Nvar pausespeed=(pauseit==0)? copyspeed: 01 |3 i2 `" r9 E; k# N; Q* c
var iedom=document.all||document.getElementById
8 k; k0 n8 g3 Oif (iedom)) g* ~6 ~5 l2 M5 S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 I, U i6 K' J! ^var actualwidth=''
$ l+ R2 R: j2 Bvar cross_marquee, ns_marquee
, r, {$ m! S; p. q- r, h
5 n% c/ n( d0 h. F7 F9 Cfunction populate(){
+ h; t, S1 ~+ @& B( q" Wif (iedom){9 Y3 d4 h, u$ b4 F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ I n( _8 U" L) r
cross_marquee.style.left=marqueewidth+8
* n! h0 y' {; B5 q* C$ Mcross_marquee.innerHTML=marqueecontent
: d! [' K2 J1 \7 v# f4 p, Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 M) Y/ h2 v- p4 D. G( m& ?6 j; k
}% D3 N/ i, R Q/ V/ S2 j
else if (document.layers){
( V/ W4 e, c/ E Y0 v$ fns_marquee=document.ns_marquee.document.ns_marquee2
4 P6 h$ A* j. V/ r1 }! R# ^: Rns_marquee.left=marqueewidth+8% A1 O3 Q- j9 |8 G) l/ q0 h2 j
ns_marquee.document.write(marqueecontent)
( n( X# B9 n8 M7 {. I' I* Mns_marquee.document.close()2 ~! w/ ]" R, ~$ F. G7 G
actualwidth=ns_marquee.document.width
( X2 d) W2 t, {}
; r: H0 H2 [0 t% u. S6 G. Glefttime=setInterval("scrollmarquee()",20)
. i" d2 U( x- Q% f3 n1 p: V5 D5 Q}- u/ t' l! i% z2 y# T( x& R
window.onload=populate% j* ~. P- I" w: Z n% X, S
! M/ w/ e" }& O$ g9 A) I
function scrollmarquee(){# E, P Z9 l1 A8 f9 y/ Z
if (iedom){' S+ ?. ]3 U& k( D$ M% O7 K- G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, {! k& D0 i# wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( E+ F+ A9 ?5 ~3 A( c2 p% I/ l
else
" B7 h. a: m) d) }cross_marquee.style.left=marqueewidth+8" `% }+ p2 k: \# e! Y
1 X3 U9 R3 o; X
}$ d1 Z" d+ A7 y5 g
else if (document.layers){/ h( }% [+ R0 g* u
if (ns_marquee.left>(actualwidth*(-1)+8))2 Q( {1 `+ N+ o- [/ R
ns_marquee.left-=copyspeed
% R0 P9 \8 Y* n$ T7 d& Telse
+ E- ?+ F8 T8 \+ yns_marquee.left=marqueewidth+8
; Y Y( R* h6 f' J) @7 n} W/ j J4 f7 D7 r
}
9 k( m9 q5 S) d0 f0 @& [" i' V6 N2 a, c
if (iedom||document.layers){5 K4 R1 g' R& q4 {7 ?. @5 c
with (document){
3 g- Z" A3 \' L+ k. e5 Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" C8 R( p' \% U! H1 b3 A' r
if (iedom){
6 I8 h6 L+ v" Z7 `+ X, ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! V$ C. h4 b* Q/ m2 e- }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 S+ i V8 x! d. uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* ^- t/ {7 {7 P( ?/ W) }# Swrite('</div>')
- {4 F) E2 s* \) ~+ J3 }# s" c}0 V+ s1 Y3 e" F2 n
else if (document.layers){8 W. m( h: x0 h+ c, d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" K# Z+ ^; i$ ~& a6 R/ D$ S" n, c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' r# ~; V' c: |( d# O% fwrite('</ilayer>')
9 Q0 I, w4 d# N( I0 m1 R6 F& k}9 f+ |9 }. ^7 X7 g, Z
document.write('</td></table>')9 j7 [# {& [: d3 _$ U0 x
}8 i5 L9 A# O3 |1 Y! K' Y. k
}& L# T4 m6 o8 _0 g* y0 |; K
</script> |
|