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

|
网页之跑马灯文字特效
//修改宽度; D* z( n% j- w, M( B
var marqueewidth=300$ J5 C3 F% Z! k G; k0 i4 O
//高度8 U8 H( `' M ]7 W" I& ~
var marqueeheight=25
2 _! V% m& h" |0 r6 A" z//速度(1-10)
) e3 ], c% T- } y8 V7 ?6 L+ Avar marqueespeed=30 T* @9 L4 y" v0 _" C
//背景颜色
$ r; L4 W% w& ]+ T4 K0 u/ Svar marqueebgcolor="#FFFFFF"/ q4 l- k+ N/ X5 o& G7 e0 `
//是否能暂停 (0=no. 1=yes)?- z# @+ ~/ K; a
var pauseit=1: [6 e( I+ U% y1 I: b. r9 ?
5 q) ~: Q- |! J' `, t1 [
//修改显示内容' a+ M$ J% q# |4 T9 b% Z# Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) {: I; l- G* s+ I2 ]/ T! M, x+ ^# R/ B5 R7 b S
: L$ d" K/ u) `. B) Z/ S1 x% b; Q
////下面不需改变////////////
5 E" i( w% V J) _( Z' x" ]5 w
s0 i0 W+ T( E0 a# Bvar copyspeed=marqueespeed5 N- t1 U% x: i& ?
var pausespeed=(pauseit==0)? copyspeed: 01 \8 x4 U! V$ @* K# M8 Z. b/ T5 e
var iedom=document.all||document.getElementById
: ?1 E! P) M4 Y' {3 u# mif (iedom)
% h- E2 m* k5 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ j) F! q* j) J3 u
var actualwidth=''4 \% y5 g! D* H6 q- N% s2 m. k
var cross_marquee, ns_marquee' I$ i" O9 @2 _( Z3 \
) Y6 u* L. u. F* z# \ xfunction populate(){ {8 Z8 X2 O" P$ j# O& t4 c
if (iedom){
9 y; _. I+ `8 c- Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 s) q0 F, v$ n% }' v8 L4 Q) {
cross_marquee.style.left=marqueewidth+8
" h+ U9 G5 w, y3 K3 A" _) xcross_marquee.innerHTML=marqueecontent
( S6 p8 `% {0 Z+ x" P" y) Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( ^5 k' h% J- O. [# g( r8 q. Z
}, U/ }5 i3 X8 m$ Q* f4 Q
else if (document.layers){" e7 M* O" c* |: z' _. q Q* J. h4 [. u) G
ns_marquee=document.ns_marquee.document.ns_marquee2
- q% |* j8 C0 ^" K7 Ens_marquee.left=marqueewidth+8& I- ~2 g1 x) H( X1 h
ns_marquee.document.write(marqueecontent)
! @) E7 o+ _2 j& d7 I Jns_marquee.document.close()8 l6 W. ], W z* {3 s3 I3 f% S
actualwidth=ns_marquee.document.width& B* p1 w, p1 H' I" H) ?; @5 @! r
}0 w. p, N! }* M
lefttime=setInterval("scrollmarquee()",20)
2 `! V7 H, |9 i- b9 @. G}
9 T$ z! B8 @6 H1 {. f9 Qwindow.onload=populate
9 T7 E# z4 S- z9 P
, T4 B* N( G9 q( H; Nfunction scrollmarquee(){5 Y. i/ r* i% O) v; [
if (iedom){
8 s1 A8 F A0 [2 N/ J& tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* M2 {0 T7 I4 W3 T' B2 H/ ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* T) l$ A6 w7 D. @3 M3 v
else
: u1 E# H0 ^7 z& Ccross_marquee.style.left=marqueewidth+8
# K( J1 ^& c; ^! c/ ^/ d3 L6 U$ @8 i' Q
}
3 I' q4 c6 P, @# z- Felse if (document.layers){
" c3 k7 f1 N5 s8 S* \% z: V1 ~if (ns_marquee.left>(actualwidth*(-1)+8))' n- a: L0 F& P
ns_marquee.left-=copyspeed" D* X7 S6 D2 e0 h. z
else$ E6 G% N: ]. w) o7 j) I [8 q4 r" b
ns_marquee.left=marqueewidth+8) ^! t* R; V( \0 O
}9 X2 j9 s8 b( [
}
+ I; z, N1 a3 y' S
$ ]. U: \5 b7 l$ o8 i! w& f' Yif (iedom||document.layers){4 T* g# M! G& _ m! W' @
with (document){- g, f* X( O- z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. ?: ?' |/ t+ V5 sif (iedom){# D* j+ o- _0 |+ ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 j: H0 v( c+ y4 e0 n% q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- Z. Z: H1 U, |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* U; t) Q0 @5 C4 J
write('</div>')
: N2 x! {5 E0 x. z, p/ q}- `% \, l. n* A' [
else if (document.layers){% Q' v( w* l8 y: n: \- U% s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: y/ N" [5 N+ ^: b# F/ swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 R+ _1 k. i, D7 qwrite('</ilayer>')
# ^* g, B: y6 y3 c( i+ F8 b}
7 L, s; V* ?# Tdocument.write('</td></table>')7 T- \' F& Q$ P2 R! q! R
}2 f8 G( Y" s3 o6 Q" r: `: i
}8 l U( P. w! N
</script> |
|