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

|
网页之跑马灯文字特效
//修改宽度
5 R9 l7 j0 d" Y1 svar marqueewidth=300
; b. t1 o$ b$ K" W/ @2 p% A, i# e//高度2 s8 b$ V s4 c$ E
var marqueeheight=250 K; d8 ^5 ?. h* V9 M0 M9 E# h5 N, K( W
//速度(1-10)
( q8 l3 [) L+ \, y! G) Svar marqueespeed=3
9 u* b4 P5 { i' o' ^//背景颜色: {, P3 F6 Q: M, `" j/ ~# u
var marqueebgcolor="#FFFFFF"9 `; b5 `% A8 j3 ^# S% c
//是否能暂停 (0=no. 1=yes)?
, L6 j3 J1 a; E" {$ Hvar pauseit=1
9 ?& v, g* `5 w7 ~& d% r* f7 r& @; }" O" e" P9 @6 D7 d' ]& s6 H0 G1 U
//修改显示内容
/ K3 _; K7 m7 v0 x( l0 gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. L3 L/ Q. Y9 T3 H1 }0 f, H$ A
2 V# P# @" }3 B5 |) [3 y. N
7 u9 w# q0 B. l, l3 F+ C////下面不需改变////////////
" F& R8 r [( g+ x% o* B
; }" h r! O& t6 H2 F' r2 cvar copyspeed=marqueespeed: E; X% ?3 [5 j0 M3 L0 O7 R0 S; F/ C
var pausespeed=(pauseit==0)? copyspeed: 0! K# A: I9 f# s5 x! Z$ y) Z/ [
var iedom=document.all||document.getElementById
+ T+ ?# K, t, O0 y; sif (iedom)
* V' a2 r) b! |# x" i8 J6 Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" a4 n# _" o2 u0 v/ s
var actualwidth='', s$ _% B Z9 T8 ~1 X
var cross_marquee, ns_marquee+ O7 }9 W8 n( `. Z" g V5 L1 \+ l
! O8 s$ M- R$ J$ x0 _# J& R' s
function populate(){9 c: k4 ]4 G+ z* ]6 G t1 D, B: [
if (iedom){* P4 e) V0 \2 w& {- Y6 d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 v; ~' Y; O" D$ D) {% zcross_marquee.style.left=marqueewidth+8
# P* G, e/ X0 s Q7 h* H0 n9 ^cross_marquee.innerHTML=marqueecontent
; p- `; K! _6 e4 v6 h$ H1 L: ^# o" }2 lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 R2 b6 @! \5 B* S% V}
! d$ n" _& O# P0 ~3 x) K: d' ^else if (document.layers){
3 I9 [6 C) m3 A. L$ ~ns_marquee=document.ns_marquee.document.ns_marquee2
- f, y8 n- s. m: p5 K0 r( B& `5 W+ ?ns_marquee.left=marqueewidth+8
4 | x; ?* v9 U+ sns_marquee.document.write(marqueecontent), j" Y+ n1 e5 _5 S! ]6 L1 W
ns_marquee.document.close()
3 p1 J- y5 b: a' m B0 N$ nactualwidth=ns_marquee.document.width1 _0 `" O& a2 f* q0 {3 [$ C
}
' t a" J2 Q. l* D" t; Olefttime=setInterval("scrollmarquee()",20)
) Y5 b7 k* [# P7 ~# d" c}# X' C5 @& Y7 \
window.onload=populate7 s) f. b, g& u- h$ K6 t
$ {6 ^" m* n( F4 @function scrollmarquee(){
5 G. {' I; B0 X6 w; j$ l% a; Nif (iedom){' Q# ~' V/ n7 J, Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 p5 j9 |' L# f1 L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 V0 I9 G" Y8 _1 D
else$ Q3 G* c5 u0 j
cross_marquee.style.left=marqueewidth+8
5 H3 a$ l" }, u% H& T' \5 A0 L2 h9 h/ a) r
}6 u% X0 k; O1 D
else if (document.layers){; M, \* W0 |" w2 [6 M: N
if (ns_marquee.left>(actualwidth*(-1)+8))
/ c' z' O) w s4 _; Ons_marquee.left-=copyspeed
3 J, {2 f* L. j0 i) g5 ^, y' z& `else7 Q+ P: R8 m3 M- Y' u! V
ns_marquee.left=marqueewidth+82 ?' O( ?) Q3 w% H6 T7 E+ d
}' h! S( B3 p! o$ p; |
}2 X* Z. Z/ l9 ~( I# M+ R
% m( [) L/ O( C- V* }- Kif (iedom||document.layers){1 p: N" Y. n. g ^' |; A+ [$ n% A# h
with (document){
: S1 i2 U/ `0 k4 Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' x1 S7 M' ~3 p# Y8 |& ^
if (iedom){, L$ t4 V" F( |" ]/ x* Y% q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 ?5 s8 z* ]' `& J7 h+ gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
S. A h( d( l zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 q( t5 [1 y( g6 L6 w3 `write('</div>')* ?- Z- \. l$ ]2 ~8 ]9 x2 [- @
}1 g) i$ e5 T1 K+ {
else if (document.layers){" D. r2 j/ S* V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- i% m; Z- N( v }7 }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 F3 G2 g/ n3 |. h) D! e
write('</ilayer>')
2 f3 o/ R2 W0 s1 r7 W8 Y" E}1 i1 p0 `4 g& E2 A( F
document.write('</td></table>')
& u* t6 c3 r, v2 T) ~+ m. t}0 { f+ F- A! {
}# G2 L' J$ W: g+ c
</script> |
|