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

|
网页之跑马灯文字特效
//修改宽度
- m8 b1 E3 n9 t1 j7 wvar marqueewidth=300% o3 z$ B+ l. s) ]
//高度3 K, ^$ {5 t3 U7 S1 g. t
var marqueeheight=25) C) A! r( g' ?! ~' {0 j8 X5 w$ k
//速度(1-10)# n0 Z# e9 {& A6 H
var marqueespeed=3
' ^- E# N6 m6 h: t: G* M$ @//背景颜色
3 F5 S8 [% y! V( a) p, q! kvar marqueebgcolor="#FFFFFF"1 [; S8 K3 k2 Z8 Z1 k* v
//是否能暂停 (0=no. 1=yes)?* k% e1 Q! p8 |: s: i
var pauseit=1
$ H, O3 v% v( v( Y
- j- N4 T3 X# Z4 @# F//修改显示内容, ?% e6 x% l9 X* ^/ {- ^! H8 w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# @7 a" G7 y& x2 r
7 X v' [* n( T3 d1 P7 A
+ N/ @) l8 |+ K' {
////下面不需改变////////////: v$ r4 p0 e( U; b& Z4 H2 y
1 g5 d; \" t2 L M. a4 N! kvar copyspeed=marqueespeed' v" ]5 e: t3 ^6 k: l
var pausespeed=(pauseit==0)? copyspeed: 0
. b8 n) U7 L; D- ovar iedom=document.all||document.getElementById
" a" l- i. _6 Y( b1 e8 F" Iif (iedom)# w! q3 a! |) x- o: S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') _) q: T b& {. y5 ^; a
var actualwidth=''
+ u) M% f* g; C) Kvar cross_marquee, ns_marquee
, t0 w! l; [1 Q4 ]3 Z+ w, W) u0 |" J# d* \: x' m+ ^
function populate(){% O" d% b; j1 f$ K3 ^
if (iedom){: h7 ?1 D% N. ~ h6 J2 C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 [4 q6 v' ^2 k( w* \cross_marquee.style.left=marqueewidth+8
+ l' { X: m, t- o5 \3 N1 ocross_marquee.innerHTML=marqueecontent9 i$ R" W! X* {4 k# x1 J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! v& [) c% a( o& \/ r1 q
}
8 [, O5 g6 U: z! K3 K5 selse if (document.layers){
# }2 d, f+ f* Y1 {5 f% W y* Cns_marquee=document.ns_marquee.document.ns_marquee2/ p! J* Q; |1 L
ns_marquee.left=marqueewidth+8
# x& O! I/ F0 R, u1 W8 _1 Cns_marquee.document.write(marqueecontent)
" U1 q& b' x) O3 B0 s7 U: Cns_marquee.document.close()
" O# R: E2 a; X: G9 Dactualwidth=ns_marquee.document.width. n$ V4 D& K- `
}7 W$ N4 M. e; h5 P
lefttime=setInterval("scrollmarquee()",20)
# I q2 t# [; p! f% L( K; V: b}$ @7 J+ J5 t$ g, k5 J
window.onload=populate
5 l, o2 s. D% ^0 W0 ?+ Z/ i
9 E, |5 \% i( t# Cfunction scrollmarquee(){
* r' y& t" x# U, sif (iedom){
* F6 P1 w2 E# Q2 lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 E' f9 L1 N' C. D6 scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# |7 g& L4 Z) L, ^8 p' W/ {" `
else
" d/ P$ b, m; Tcross_marquee.style.left=marqueewidth+8
4 s5 N# |( r7 G$ }9 E
% e7 S! \# k& I}' r- ^4 |4 ^' k9 X
else if (document.layers){
2 b1 u( m' t: B+ D+ f, o" kif (ns_marquee.left>(actualwidth*(-1)+8))
$ v6 c$ H* E. ins_marquee.left-=copyspeed% a, C' W- E0 b3 o B9 o
else" v) ^" t' y0 n ]: h
ns_marquee.left=marqueewidth+8; k, A; L# U4 ]# s: G
}
! m/ \: q- Q, V4 V% g6 B/ A}
( Q3 O7 w3 v7 V! s
, K; t* g1 ^# i6 @& O e5 Xif (iedom||document.layers){1 N# V& v4 F: C9 V( I" ?
with (document){9 d6 H" i/ V1 q# _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 ^1 x2 ^8 [0 \) n+ |1 K! M" Dif (iedom){7 n$ F H: |9 Q m9 {- X! E9 V% F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ c. E4 v. Z7 V) D' M7 D! Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* x! r' v9 ~* ~6 o K" j% ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ E3 {2 j! F& A9 `
write('</div>')
* s( Z: N8 T; U5 Y V}
- x- z- H7 G! F: n( c+ pelse if (document.layers){
$ z* h0 U2 u( [1 owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% W6 L+ i% y) Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- B+ c9 i/ _, I; Q0 Y5 h
write('</ilayer>')
5 V0 B- s+ d1 t4 A}6 U: W- K) l' w2 t8 p+ G% m+ \: y3 R
document.write('</td></table>')
- ^% X0 l& d- [& [! z. _}
8 U! \& _3 N; R4 ~* i, |7 n}
7 Z1 i, L, J+ O9 S</script> |
|