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

|
网页之跑马灯文字特效
//修改宽度
6 x q5 r$ q+ z5 yvar marqueewidth=300$ {5 U' P' t( N6 S- i- m' F' h
//高度
5 M$ I# i) d6 G+ ^* X+ @. Jvar marqueeheight=25. A" y- o/ }6 ` _
//速度(1-10)" `# K, D; F" G( s
var marqueespeed=37 {( o3 y* g8 v& E4 A2 C' U5 \
//背景颜色
: {; k8 @+ t I6 d7 mvar marqueebgcolor="#FFFFFF"
7 s# \0 p; g) A* c5 g! Y: R//是否能暂停 (0=no. 1=yes)?
" ~! U$ r" R _6 v. D7 Z% ?var pauseit=1
4 H; ~3 \5 `8 u
$ E, N( W2 Z- S6 c7 Z" {$ s//修改显示内容2 e- r7 H [7 ^ L! w( d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ g' `# G; o- ^2 W$ y
, \' C z' K5 n" T1 z" k; a% E
$ e- i. g3 m6 X y, U8 K////下面不需改变////////////
' z+ G* l3 J9 u( i; J/ N/ X
" x( y% Q9 O+ d5 I9 h" R" ?var copyspeed=marqueespeed0 Y4 }0 a2 {5 g( D# V
var pausespeed=(pauseit==0)? copyspeed: 07 f$ @4 t2 d3 q" g) Q
var iedom=document.all||document.getElementById# u3 e$ p/ |: g9 e+ X$ E7 X
if (iedom)
5 `5 p# P) R# ?: Mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 Z5 u2 F& m, ?: P5 `$ J7 T
var actualwidth=''
* d, Q) |! F$ N' Rvar cross_marquee, ns_marquee
/ D+ L1 v5 o# R. R$ m& W3 Z! A" _- t9 {
function populate(){' z4 Z7 f& L5 x9 d& d- e
if (iedom){
' L! }$ q$ N J. q R7 Z0 g2 jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! O- Y2 w3 N' z; z- e! ~cross_marquee.style.left=marqueewidth+8
; ]1 ^. H" A) j0 @4 W* D0 Fcross_marquee.innerHTML=marqueecontent* S h1 v! r: l* i$ w" `: i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 `6 \% [1 t" N
}3 M/ S P7 u) l& D. d
else if (document.layers){# D7 M9 s' l6 X+ w, r2 f! k. A
ns_marquee=document.ns_marquee.document.ns_marquee2
# g s+ M% C }ns_marquee.left=marqueewidth+8
p. D% Z; f! D- e: o- O' t0 Vns_marquee.document.write(marqueecontent)0 o% h$ q8 N5 m7 }3 s% f
ns_marquee.document.close()- a) j; P8 W4 o$ O1 p8 z8 k8 S
actualwidth=ns_marquee.document.width
1 M9 \& N5 m3 u5 u9 [}
; j+ q6 ?5 z/ J' b( Zlefttime=setInterval("scrollmarquee()",20)
0 K, w5 `4 }, j4 v}
! H3 U0 t+ D' o7 kwindow.onload=populate v+ K8 N* o4 J' D9 A% J) P
5 a8 h1 u7 g, n' L5 I3 }6 O0 W* Nfunction scrollmarquee(){, e' ^8 i" E; r9 q1 d! e* v# H- [
if (iedom){
. E0 k6 x& z" Y/ |5 H4 U7 A- \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* V. S& W& G' I6 \% Q$ q S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! c% ?+ I, K7 g- S W& [4 Y/ P7 _else0 O& X- j1 j/ I$ Y9 N
cross_marquee.style.left=marqueewidth+8) F3 A- v* g" x$ L" i, k; ~
! E/ w* j0 a8 B8 s}
( x: t# k; H# n, P5 r2 n! uelse if (document.layers){/ Q0 A4 r( T2 W
if (ns_marquee.left>(actualwidth*(-1)+8))0 G. f, e! x) ~0 A8 @
ns_marquee.left-=copyspeed
. s' T0 Q/ w( v1 p2 H( `: }) l4 [6 delse" d0 e: Z6 c- U3 R$ l5 K1 W& p
ns_marquee.left=marqueewidth+8) `. g1 N* z1 @( P0 N" g8 E6 d
}5 [/ }# s* f) @$ s* [
}3 A$ p; v: T( C4 H7 x" e4 n
5 [4 w1 W% D! x& F2 z& Y
if (iedom||document.layers){
( m2 L5 u) \0 `/ k6 swith (document){
( S$ l, M7 b0 r# {9 Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, }, |' @ w; T ^if (iedom){
( z7 x+ R* l9 ? {. V7 S8 K/ uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% Z/ t+ r1 J4 W( u) f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 S3 d4 ~5 X- lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% ]) a# i6 ]3 L8 P. u' h: u1 ?write('</div>')
& _" K, ]# l+ |9 v}
6 W" c) c y; I% n. aelse if (document.layers){3 E' d& H3 r; d5 r0 p( X* M8 F8 Z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 R h, j, J2 X) B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; l. |0 @) P i" [9 vwrite('</ilayer>')
, z# u9 g& S+ I+ ~}
2 q" J' l9 S; R9 Kdocument.write('</td></table>')
j8 v! M @' j}
% z( f# @, A* n2 Z" `: N}
' ] p- D3 X' F- r& X2 g; I</script> |
|