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

|
网页之跑马灯文字特效
//修改宽度" a6 J& S X' {. h
var marqueewidth=3002 z; R$ U( ~& n. ?: Y
//高度
6 }. E8 |; h# rvar marqueeheight=25
8 e( b6 f/ o1 d6 @0 Z% m//速度(1-10)5 O8 P* Q: m8 R7 Z+ B& L
var marqueespeed=34 _; `# P. e% {
//背景颜色
! I' T5 U/ f; G' {+ G; R6 J0 ~) {var marqueebgcolor="#FFFFFF"4 V9 ]8 o& d8 b; s! L9 P
//是否能暂停 (0=no. 1=yes)?
. a, N- w4 g6 _: H) ivar pauseit=1
: P$ ^6 U/ @ h8 X& c6 |% f5 s/ w1 H: s+ d
//修改显示内容1 K9 k7 i0 N/ W% M4 @6 q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ S9 `; }. _" r; ~4 i8 E3 ~4 k
$ T5 }5 g6 L; U. c6 d
/ ~: S; h5 R% H, R: I8 Z////下面不需改变////////////" }/ G4 `* ^7 W) |
9 A, \+ y: {$ T4 Ovar copyspeed=marqueespeed; h* h3 U! S5 n: o# [% b0 f+ _; I
var pausespeed=(pauseit==0)? copyspeed: 0
7 T+ q# k( Q" w- Evar iedom=document.all||document.getElementById
% A9 S# ^9 C4 f9 C9 q% n; P- w9 w) H" |if (iedom)! a* t/ X5 D" S# o8 T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 n- {$ _2 q* e/ j/ {$ H" k- F3 c* nvar actualwidth=''/ N$ J4 M) a: ^; p4 K
var cross_marquee, ns_marquee* z# l7 @( J6 _+ u* \" S( F
8 _3 ^* Y% {+ y. v6 g4 ~2 w9 m( s0 Pfunction populate(){8 J9 [$ I# F n( k
if (iedom){/ W* V3 h+ J2 h' ~! S( o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 U4 _ d+ j# b X
cross_marquee.style.left=marqueewidth+84 f" u0 H& f* ]( w4 |/ E% ~ P) U
cross_marquee.innerHTML=marqueecontent
" P/ c( J+ I+ T2 t: factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ U( D' I" `* d) e3 D0 U}
7 P( b) B% h5 y5 G Y0 melse if (document.layers){# l6 q* p- O. V+ g. `/ J1 R9 w
ns_marquee=document.ns_marquee.document.ns_marquee2
" o9 R: `+ k5 m8 N7 P4 L1 Bns_marquee.left=marqueewidth+8; e I1 t+ J. Q- [
ns_marquee.document.write(marqueecontent)
& \# p4 @4 S, ]: Lns_marquee.document.close()! O! z/ \& ?. u* o; D+ K5 D( c; j
actualwidth=ns_marquee.document.width# C8 d2 Z& ?7 B9 C+ b' ^
}
5 ]6 d! X% Y% r7 @2 r' Wlefttime=setInterval("scrollmarquee()",20)
0 C' s2 @$ [! g% S4 h+ H: S}- \: \/ d9 h- q( _# B
window.onload=populate
# V* X2 g* P- _+ t- @& ~( |- \; U9 y) U; t
function scrollmarquee(){) P7 K& }! L+ |( E( e* a
if (iedom){7 w# u# c0 ?/ F9 i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) H0 i3 b2 @4 ^# \3 t# Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 U2 |0 o% j# g. f0 Welse' ?/ P$ w5 ^; k2 j( h- d
cross_marquee.style.left=marqueewidth+8* d: {, r5 Y8 `, C8 ]
. _6 |5 [6 V# P8 y
}
8 V2 W, q0 T) X* p7 t* Telse if (document.layers){. i9 a: @ F! h3 C" \# Y+ f
if (ns_marquee.left>(actualwidth*(-1)+8))8 [$ `) ]- p8 \! b f, j/ E$ ~' F' N
ns_marquee.left-=copyspeed6 _1 q4 U1 k% ~/ ~8 [
else
3 v2 J+ m! F5 u. _ns_marquee.left=marqueewidth+8
* {" f$ A3 a) e2 v" I% C}
4 [5 c$ `0 _& Z5 ]' u: A( \7 |}
2 h& R& _6 i/ `3 C/ D/ v) L
: M' f! ?5 ?2 P/ rif (iedom||document.layers){3 E% S) D2 ~" [0 U! I7 c
with (document){
9 l4 y8 }, U' Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 ]& T( k- z0 n0 R1 l
if (iedom){: x+ j( B4 b% Z* j ]8 U1 Q1 K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% |# V/ p3 [5 f. ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' M, o# q2 }) C8 w$ J! a+ iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% _5 P5 i/ p: y d3 b+ w! `write('</div>')
; c/ w; L) ?0 N6 d}9 ?9 x) f; G$ }. @+ M6 m
else if (document.layers){
* u& h4 d; K3 X. R4 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ f! ?8 X' R, o( H, n1 Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 L$ ~2 M- O9 k, T3 v0 g- xwrite('</ilayer>')
1 k3 X0 a* s. W* w. M x0 f m}3 ]& N5 ]8 D- U: x7 l" j
document.write('</td></table>')
# h2 J% W) ]* m6 n9 s& I5 h7 V7 U}4 d* _3 q* R, N, ~! [: x
}
6 O* T7 C5 K* M: C* D</script> |
|