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

|
网页之跑马灯文字特效
//修改宽度: T t/ P$ e& B% |" `) \
var marqueewidth=300: R/ e9 m0 k! a" i6 M# F
//高度8 r9 h! i* r$ L2 e
var marqueeheight=25. n+ U& c' ^& T2 S% t6 a0 z4 f
//速度(1-10)- V3 C' D* I$ ^+ [
var marqueespeed=3
7 \3 t$ O6 @# L7 Z1 V& x! Z//背景颜色7 H" Y) c2 R; Y& ^/ S! C0 @/ {% C
var marqueebgcolor="#FFFFFF"
, }* S1 H' V3 S- p8 T+ _//是否能暂停 (0=no. 1=yes)?
6 o9 X4 R5 p9 ~, c, v" Vvar pauseit=1 j Z- |6 S' H9 L
! z% d: p3 a; o3 D% H) H# S
//修改显示内容& e. _/ t0 i3 B4 H7 t7 ~! m+ Q% C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( e% y9 O( D, v) L5 m% S
: \- }8 d. P3 s# v
+ T) p$ G! e+ a' }9 y( c0 x////下面不需改变////////////0 H% e8 \ i3 B
% o6 M1 W" H! ]3 P% N5 A
var copyspeed=marqueespeed8 H" H5 H# K1 P/ u
var pausespeed=(pauseit==0)? copyspeed: 0
& ?) g2 \3 y9 H# h( kvar iedom=document.all||document.getElementById
; i. [' M) z- H0 v! m, e5 ~/ Bif (iedom)
( d K7 i: i s& a) c Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. @; [+ i k `, k" Q& R6 Z( ovar actualwidth=''
# f, L4 }% H* c, Y7 Z+ t0 R0 Nvar cross_marquee, ns_marquee
: x& X0 R: w; d) t2 K
; i$ z% h [( l: L1 F! Nfunction populate(){' }% G: n: B7 J: g- O4 R4 q
if (iedom){8 [6 Y) x) {$ p* J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& f, Z! O! x" E4 u/ icross_marquee.style.left=marqueewidth+8
! ^5 h" V( x4 P6 Jcross_marquee.innerHTML=marqueecontent0 [0 z$ F7 j& x# _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 t3 y* c( ?% z9 d}
4 i {' u8 |& i0 Gelse if (document.layers){ H W# d, K, C2 t2 ^( ]
ns_marquee=document.ns_marquee.document.ns_marquee2
. q6 W) H' G* l- V9 Zns_marquee.left=marqueewidth+8
, B# I+ r8 k8 r# ~, s1 lns_marquee.document.write(marqueecontent)) k. y3 G& Z- i A
ns_marquee.document.close(). {/ c% b t) T% ?! \/ F* a$ s. o& P8 ?
actualwidth=ns_marquee.document.width4 v- c4 C3 ^, z f0 a9 B
}
# b/ S' R7 ~1 q" z2 v+ M* c$ l" jlefttime=setInterval("scrollmarquee()",20)
6 o( o6 ?# `) _5 h2 ^}
. e/ ]/ N+ I2 a" E% Q, _window.onload=populate
, r3 z. N9 T! s6 Q6 ?% H9 Y) H8 L ?
* C8 Y ^. ^' ^7 C* T: Y: I& Cfunction scrollmarquee(){
- i4 p8 ^" P0 A0 a( mif (iedom){: n, e9 [5 o! g( ~3 ], R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 P* }2 O; w* s5 h! b' ?& {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ u0 C! H b1 [& C, k, ^
else# P& r6 @( W! |
cross_marquee.style.left=marqueewidth+85 v1 W6 N/ f3 g/ w% D
; `% i9 [3 M$ w0 R O}
) x' D1 E; l9 O0 y6 X! w3 V1 f6 Xelse if (document.layers){
+ t, l# O8 I2 vif (ns_marquee.left>(actualwidth*(-1)+8))
7 V/ V9 C# N' Q# v! t4 [! i# Tns_marquee.left-=copyspeed# I) B/ V/ N7 L1 G$ M
else4 m" \4 H, L+ N, c" H; O5 I& {
ns_marquee.left=marqueewidth+8
" F% O1 H6 ]4 f% a3 H4 c1 X}
7 ^3 L. P2 K& f4 V}% N9 m: l2 ^: e
4 w+ U9 l2 t* ^9 l k8 ]- a- x/ i
if (iedom||document.layers){
1 X E# w1 x- c. G/ Awith (document){$ p, }0 {0 O1 u* A& @( s" v8 _. h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" F7 u g2 g1 l9 J5 G, ^. K4 fif (iedom){; N/ G- D6 P1 B2 Q J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# |: P: u- q r8 d( l2 i7 Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 \( I9 p, r/ i* ~% Z, k5 y; i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 H H( k$ c- _0 ^! L# \! H6 {8 k2 cwrite('</div>')) D% T( |9 d- e( z
}$ U& }7 i: i- v
else if (document.layers){3 l9 c* w) t' N+ i+ }. _1 c8 J3 f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. f( p, U$ U. T1 u( |% l5 Y. Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# v! }. c; ?8 l% B8 Fwrite('</ilayer>')/ n9 P& O+ S8 a
}
% @6 c1 t: Z* f9 @3 [' r0 Xdocument.write('</td></table>')8 y$ p6 }! a. D( S5 p' I
}6 W5 W6 _$ V2 F
}
3 e5 o" z7 Q/ V$ H# G</script> |
|