返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ K3 l4 C( ?. O" R; O1 N# P7 s
var marqueewidth=300, ~! H, a7 [, g1 n' x; {
//高度
6 @- D$ o' }3 ovar marqueeheight=25
3 ?4 K5 w: H: p  v0 g- I3 c//速度(1-10)
' J. q3 m5 c. o" _' m. Y  vvar marqueespeed=3; W3 L) e6 i( p; i
//背景颜色; O  n6 W5 d# `6 ]$ U
var marqueebgcolor="#FFFFFF"' b! ]' V) P: z  G/ D- n8 ?
//是否能暂停 (0=no. 1=yes)?5 I: S* w* S5 m$ l
var pauseit=1# M, W% S( @8 f5 m3 m2 ?
5 Z9 Y1 E8 ?0 G, L5 |1 [0 |
//修改显示内容" v% o; X' c. m/ r; r$ q8 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, r& e$ f/ ~2 T* F- {& C7 V& ^- A

9 U8 P) F( R' i1 b" E0 L. ?5 [( n////下面不需改变///////////// J6 G4 h: n/ I. \
6 b' D/ N# u+ \5 a. N
var copyspeed=marqueespeed
1 d1 C$ ~% I7 l2 Cvar pausespeed=(pauseit==0)? copyspeed: 06 x% w) @+ _6 F/ z1 w
var iedom=document.all||document.getElementById
/ Y0 G3 T# r. y0 C: C# dif (iedom)
+ x! ]. o6 Y5 n( |6 x! X& Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 G, w8 H# k, f) Z; U% r
var actualwidth=''4 K0 n$ B8 P8 e; {6 B( s1 j
var cross_marquee, ns_marquee
4 O" K8 H- ]# s; |5 `' R0 a5 R, d, D6 C1 W; @* T8 K* T. Z  `2 \
function populate(){
0 _  {, w$ O" h/ j" @if (iedom){) E5 i9 M# t! o/ t5 W+ V: \+ I1 ^& B2 z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# T! e0 Z; w! n: G) A$ ^
cross_marquee.style.left=marqueewidth+83 G% ~8 h/ [7 o! m, f% f: e
cross_marquee.innerHTML=marqueecontent/ I% A- y! t. C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( J# m, R9 A( q( n4 C. t
}
2 K: y# a: L/ ~; i4 [8 J1 h  v8 aelse if (document.layers){9 `' b. d; ]- W% S; M$ b+ v9 ^4 K+ {
ns_marquee=document.ns_marquee.document.ns_marquee23 j, [2 U+ X' F5 l  `% z  h
ns_marquee.left=marqueewidth+8
% d/ d3 q/ W3 \) ]3 Z# Fns_marquee.document.write(marqueecontent)
1 d" J, `6 k& ^. Nns_marquee.document.close()
. j* V+ w7 P9 H* P# \6 |: Pactualwidth=ns_marquee.document.width
7 q  W$ i0 B# T" b6 [}: u6 y& z. `1 X, Z
lefttime=setInterval("scrollmarquee()",20)2 Q) r, |) Y6 ~4 }4 w' s" j
}
. |& g( U0 K, L3 R4 ]& r: mwindow.onload=populate! Z5 C) ]0 _6 {
- S% Q3 |+ k) L' a% L! Z6 `2 u% h
function scrollmarquee(){4 G! O/ G7 y" ?7 P9 O7 z. w8 I
if (iedom){
/ L+ g0 B6 y1 z3 hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. z$ y% u+ V, Y( v4 k+ Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& p" I0 `2 \& a* s7 C1 Q3 |. Velse$ k: `! h' s% j. p- H* m& D1 K5 t
cross_marquee.style.left=marqueewidth+8- V/ @; a( q" R9 a
9 Y0 e5 [2 `8 d' Q9 H& I
}
5 t% V2 O1 M) }else if (document.layers){! J( \1 Y( L! A* {3 o
if (ns_marquee.left>(actualwidth*(-1)+8))$ w9 J1 [$ k: D) j
ns_marquee.left-=copyspeed
% K" {7 k. `7 M+ d& P; lelse
/ K% T6 @, {4 f/ M' T( [5 p, I" O0 Y. Vns_marquee.left=marqueewidth+8
% Q) J; s& _- S) D}0 w" \. K4 U; {
}6 y* e, C. T* O0 K- e( |& ~9 s
9 T, `, m0 c* h/ P4 |5 Q; m" M
if (iedom||document.layers){* F- |! g% x+ ^) c8 D
with (document){
: s- v0 |/ z6 d7 d# D& gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( _- n4 U6 j" [3 L4 d, ]5 Dif (iedom){( f/ N( b+ a) n, D9 O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& z' {9 l3 F% R) Q! X9 \' a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); _1 m% o" }4 `; T, x4 K: `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* ?  E' u3 y1 {7 B, C  K: G9 Bwrite('</div>')3 R$ W7 b% A$ |. j
}2 r& w- a& Q9 i+ t  e( a) g  k# i4 s
else if (document.layers){
9 Z% [* L3 s2 @1 e' N$ F. C6 uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 v% l* t/ t! [1 \7 W8 [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 P( ^- V2 y9 w- B, B/ D$ L; o/ l. D9 g
write('</ilayer>')
; j, Q/ A. Q# W1 c}  q9 j, {( {( D5 F
document.write('</td></table>')! j7 t( d& F5 q1 C- j' G
}' x3 b, x; z+ h- l
}
$ {, }, `+ K! [9 w7 t! d$ }: G, w: O</script>

返回列表
【捌玖网络】已经运行: