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

|
网页之跑马灯文字特效
//修改宽度6 u: N' H& S0 T
var marqueewidth=300
$ U: t. n: ?6 r/ {//高度1 J4 M! s# e" G& i
var marqueeheight=25% i( m8 t9 U$ M. B6 _
//速度(1-10)
1 t% r; ?& c5 F: k" xvar marqueespeed=3
1 h+ ^6 Y \5 o0 \//背景颜色" F a+ F" E# ^$ s. Q" ~8 `+ H
var marqueebgcolor="#FFFFFF"
; w3 ?, x7 j1 r& B. d7 S9 j0 W//是否能暂停 (0=no. 1=yes)?
& G2 j. S/ _7 a$ A% pvar pauseit=1
( q5 a/ R- ?! W0 h1 \9 L! S: w+ \
//修改显示内容. i# N- z/ |4 i. I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& b4 u3 n: i6 ?1 f
' @6 y) E4 d! t3 s% g
0 a, {; I/ w* ^% b: K5 ?7 e' B
////下面不需改变////////////* \; B2 C2 z1 I i& k- y
# X# n! m; p* A H8 _8 qvar copyspeed=marqueespeed9 L3 @3 x, \- z# d3 S$ D
var pausespeed=(pauseit==0)? copyspeed: 0, O0 u, f7 b5 x/ z
var iedom=document.all||document.getElementById0 U% @2 |' s6 w
if (iedom)
, ^. V0 _! J) |' m5 qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): ?: L b& L4 ^( C: t
var actualwidth=''
! n9 y, m- j1 O. x- {) ?var cross_marquee, ns_marquee
2 j" i$ M' b: u2 @3 ~: f, [; J2 `+ A/ _2 y. ~' f" C! O8 P% }
function populate(){
8 i2 ~) c. J; k9 m4 Mif (iedom){
) s( M' u3 D' {& s A+ \% g- ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 Q, |0 _& R7 Pcross_marquee.style.left=marqueewidth+80 X& b- @! H' l a! T6 j% }: {2 R' d
cross_marquee.innerHTML=marqueecontent: S, |6 c. P) P. N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' v& I; ~/ L6 U k' H% P1 m}/ y% r6 n1 C9 l& Z' Y
else if (document.layers){
% i. X' G4 ]; n& r6 [4 {ns_marquee=document.ns_marquee.document.ns_marquee2
2 K9 R: L- Z' v' m& h' G6 J! y @ns_marquee.left=marqueewidth+8' l! r) \) A# Y2 z6 [. q( v+ C& b
ns_marquee.document.write(marqueecontent)
4 L& l2 R, c! C' s0 d' z( Dns_marquee.document.close()
i6 Z9 c! ^+ C/ F5 R, Lactualwidth=ns_marquee.document.width
( c; [9 a& e" X6 k6 U}
* m+ J& a/ i7 w+ Q7 |, H+ \) V4 ?lefttime=setInterval("scrollmarquee()",20)
0 {# O( g. f+ F3 Y}
S; ?3 C/ {0 @/ v x) S* nwindow.onload=populate9 E& z/ U6 g3 a% ~
7 r+ u( L4 T9 V1 { Z# Q' M. l9 U
function scrollmarquee(){' a0 o1 W- r& G3 x1 v6 E
if (iedom){. ]' q+ n$ w) K2 Y9 I, K" E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. T/ n* }5 G& f% @3 J9 pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ s8 S/ C( _3 L4 P
else
% t" @8 [7 `# {$ |, w' {2 i/ {+ B! mcross_marquee.style.left=marqueewidth+81 F% ~5 b! a! y) g+ x: I6 L8 r: R
' a1 u1 G6 {% ~) l- M
}
9 ~# S3 t: j1 yelse if (document.layers){$ ]7 l& D) X% ?# Y0 D. e
if (ns_marquee.left>(actualwidth*(-1)+8))
: _2 ]0 P9 p8 o& p- w) k" |* h: ]ns_marquee.left-=copyspeed+ l% E0 \( A$ H* d& u' ?4 r) s8 l
else( f; o/ Z8 t( t+ ]8 O
ns_marquee.left=marqueewidth+8
/ B! g/ R) D( Z6 Q& W, ^}# u0 w, J( Y3 z; ~. m
}$ f S X1 D# I5 Z9 z) Q* {5 z
6 r0 `% d+ ^: r" a9 d
if (iedom||document.layers){$ `8 M8 V0 J5 [+ Z' o5 {: X
with (document){( v% G% z# U& w& P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& m1 ^$ ?4 ~2 r- a8 R% U
if (iedom){/ M8 ^0 D n( f, g; S5 o0 O$ y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); p+ r, v: l. k: Q$ B' z6 `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ H( F, f! I4 _2 o$ ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. F/ U9 V/ ^) K( z3 k$ D+ @write('</div>')
) I3 K* N3 W7 i/ w# M8 f}- d3 F/ O0 j& M
else if (document.layers){# e: C4 P8 k# h5 [/ G7 ?. o* n G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 K' I3 x9 ~ \2 `" [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" I8 O' I3 g6 I* ?: S0 I
write('</ilayer>')
3 Y O' I) C! g: D% |8 w# Y2 R}
* u9 R+ T* q1 W+ @2 ~/ Hdocument.write('</td></table>')% I$ Q. }' j6 U" r& E( X
}
* m5 ?, x- S9 G1 W- v6 X}! s/ i: G R/ a& | b/ m( _
</script> |
|