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

|
网页之跑马灯文字特效
//修改宽度# t; T3 Z- q6 q
var marqueewidth=300$ `; I& g5 h/ F( L4 W4 J
//高度5 `# I: E0 p8 b9 l# Z( O& w I
var marqueeheight=25' M' T8 M" Z' t4 ]4 {5 V
//速度(1-10). O& I/ M* N/ _& Y5 R3 m1 u
var marqueespeed=3% V" W3 F! M/ c" @/ `( w" W
//背景颜色! h! T' p/ U# k$ v, r! d. ]
var marqueebgcolor="#FFFFFF". C V1 |0 o* z( c8 e# {+ T8 X
//是否能暂停 (0=no. 1=yes)?
* m9 a# y2 W! r0 x$ C- q( yvar pauseit=12 V. _. j! E" h6 f
0 g- a5 \8 c! F+ R8 s, K
//修改显示内容
( f8 V6 q) c1 L! E( m/ ]5 Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' b* E. B5 t) [0 F* Q6 A
. \3 y" Z& X4 W) D
5 F& i& s4 a- D R: U) {////下面不需改变////////////8 G8 h" ~ t$ y! T3 r: ^5 y4 E
( B2 p2 K7 q$ ~+ ]4 _
var copyspeed=marqueespeed9 H w! {7 u8 L) ]7 E
var pausespeed=(pauseit==0)? copyspeed: 08 ^4 e, P7 b8 x+ r6 K q. N
var iedom=document.all||document.getElementById! b: T9 R% E/ ~! }7 y5 Y
if (iedom)( R. u4 W8 U% b+ ]$ S8 T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ p4 }+ Z$ b7 f8 S- S4 ]var actualwidth=''" c: ~9 g: f G8 p
var cross_marquee, ns_marquee
* G) N5 }) N6 `$ U# w3 e0 O" @8 q
6 q5 J$ c7 g% H0 ~" Z) M* zfunction populate(){
5 f) T9 o4 W) y! ?9 `, v, ~if (iedom){
/ [* z( b5 E: k2 s8 r- @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, ?' j$ D* M. Icross_marquee.style.left=marqueewidth+8
! ?# L2 N/ B# u- O6 D q% Ycross_marquee.innerHTML=marqueecontent
% y# F8 ?: b! _7 h3 Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: [1 E0 m k: W+ Q D/ r# S}
& k) `9 K5 Q# o3 B4 Pelse if (document.layers){
0 ?: Y4 I/ n& S& Y0 Z {" D0 zns_marquee=document.ns_marquee.document.ns_marquee2, c# K" M, X3 H$ r# c/ T
ns_marquee.left=marqueewidth+8; H% ^$ M( k( l. w% Q. c
ns_marquee.document.write(marqueecontent)
0 O: l# ~4 z7 g8 a* ^7 Z/ Cns_marquee.document.close()
7 J: \: y8 d7 i4 b8 _actualwidth=ns_marquee.document.width
6 Y8 Y; G" `) n}
4 Q5 R O% r* @- c( [8 Tlefttime=setInterval("scrollmarquee()",20)
& G. `" W3 H$ U# C1 w7 T}( M" S3 {: n9 H$ d$ w0 r! U
window.onload=populate* [, ~+ ^+ [. \
( y) [4 `: e( v' e/ m1 Y3 Z0 ]
function scrollmarquee(){7 ^$ w$ l: ]. Y- M5 l# Z* e" r, g
if (iedom){
' o2 V# M9 t' k# }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) k8 J# }1 o3 h5 f* \4 z7 W$ ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ z* X! J; |0 F
else
; J/ c7 U3 A+ Dcross_marquee.style.left=marqueewidth+8" u3 l$ x: }: p- K( K" p* d3 U( h
" K# ]3 |4 _4 b, y
}
( a, D1 e/ l9 ?3 O: oelse if (document.layers){! _/ w1 @. [0 T. g( F
if (ns_marquee.left>(actualwidth*(-1)+8)); M- \4 Z( O9 B
ns_marquee.left-=copyspeed
, Z' e* s- k: E, f$ L3 u! [7 welse
( @) M, r5 v B# vns_marquee.left=marqueewidth+8
3 b( f+ I8 t& L) b}
5 w( [' o+ a' [( g T T6 f b}
( T7 P6 n( r; V8 P& o$ ~
, m/ x1 I' S: \4 v9 E' Cif (iedom||document.layers){
8 }5 a- w+ ^: V( {with (document){) V/ A! H: z7 k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 }+ ]" F% z, e9 [" F, a$ uif (iedom){
- n) Y X8 [8 g+ S& kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 G4 {4 T% b6 p- }
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ p8 r/ B4 q7 W- m" ] bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- u) e# R$ x. c* h. e5 F- h% W; i
write('</div>')
% y6 x1 _, d* c) j& K9 ]: M V}
( P6 C; s5 y1 v1 M$ K' Delse if (document.layers){
! z# i& L( P6 e7 x- ^$ Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* @3 t, f: \4 Y1 B/ ?1 L" H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 ^7 I, ~. [) B6 Z1 r' \% r* m
write('</ilayer>')
* b& N1 r$ D4 O6 p! c$ F8 J}# [8 C( j3 X( j( y: A5 Z
document.write('</td></table>')
, p- N" a% K2 [" e, g% y}
. v3 i/ o5 M' Y}% Q% H* r9 z y
</script> |
|