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

|
网页之跑马灯文字特效
//修改宽度9 f, T$ y% \7 q; U% C
var marqueewidth=3000 K) X+ i2 q5 Y7 r0 C
//高度' y. `( s1 B) O5 P$ A) l8 c
var marqueeheight=25+ E5 q) X6 ~% g5 F; w$ p4 t* Z
//速度(1-10)) g- y5 f1 P# o4 ]* G
var marqueespeed=3$ z% p5 l# C7 U0 K$ P# j: {
//背景颜色
& M _' F' i evar marqueebgcolor="#FFFFFF"
4 k0 G8 h( n W. M& ^//是否能暂停 (0=no. 1=yes)?
7 X, p. F+ z! G) Z& ]) r5 f+ O9 mvar pauseit=1
1 h1 m! X# @$ m; _$ @; n4 t- i& b5 N' W: t* J% r
//修改显示内容
l' j/ c7 o# N2 x i5 G$ nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 I1 M$ I4 d8 A- h7 h/ j4 o7 s# F" {+ {
! T/ }8 U3 H$ e) M9 g# ^) E
////下面不需改变////////////( f& b# ~: w. @* I- ~1 Q/ n3 J
/ u( {2 n: o% U
var copyspeed=marqueespeed
, l9 C0 X$ W: K# M2 E- {! evar pausespeed=(pauseit==0)? copyspeed: 0& |0 c8 S0 c' f; z2 }+ u
var iedom=document.all||document.getElementById2 `, Y7 M/ K9 B# u6 e
if (iedom)
+ V6 |* @6 T9 c- { H* v# z' Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 P1 b& I( o' S' M: z
var actualwidth='') X0 ]& p' I; F3 [7 u g H% a
var cross_marquee, ns_marquee
0 u- h; n8 a+ }8 F! E2 v* e
4 t* V) F: o- V- S8 wfunction populate(){
- p! `- x) T0 y- M% J3 ?; L& Nif (iedom){
1 V6 }$ d& H0 N8 Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, ]: u: h v1 |/ u& I! X# ~2 @0 Zcross_marquee.style.left=marqueewidth+8
, G( n3 A, w5 `- O$ r/ r& c' Ecross_marquee.innerHTML=marqueecontent
; G, p1 @: {. J3 _) aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" X7 j/ Z' w/ y0 S
}, _- }% f! ^7 D# D6 M) T- U
else if (document.layers){
5 {# e: x2 B$ w3 {* Nns_marquee=document.ns_marquee.document.ns_marquee2+ l- x4 g& G& q
ns_marquee.left=marqueewidth+8
! O% k9 T5 A$ V& V, R( u+ S2 Jns_marquee.document.write(marqueecontent). t$ ^: t3 R) V. f2 B1 ?( K
ns_marquee.document.close()1 |3 F. c+ `# v. V0 o
actualwidth=ns_marquee.document.width
+ M+ C! N$ G) H}
$ b/ }5 R7 W# s7 T( G( V! h4 i: ^lefttime=setInterval("scrollmarquee()",20)
; {% i x4 }* P* y' j$ j. |% g3 v}* L2 }8 l( ]# q: {( H* X
window.onload=populate
' w" q% M# A" R! @. p' [% r# g& j8 s- d0 R
function scrollmarquee(){$ c! H+ d( I4 B0 h2 w& {7 E
if (iedom){* b% C8 k; x9 K# K/ V& {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 |7 Z% U0 H1 Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) R) r4 G5 T( i. l
else
; y( a" `6 ?: u# icross_marquee.style.left=marqueewidth+85 p5 `- ]2 X7 `1 I% _* r
8 e f5 H# j7 U G* @, }7 n* ]}& t5 g; I; U& S3 q
else if (document.layers){
" c. z v: x3 O# h$ kif (ns_marquee.left>(actualwidth*(-1)+8))
) A/ |; D Z4 Y$ L% Lns_marquee.left-=copyspeed- {) i5 `; H9 n7 |- J/ X
else
4 h2 J- p5 J0 }ns_marquee.left=marqueewidth+81 W& R1 o6 E0 J, q% v
}, u m3 E7 n+ y* b/ W2 \
}5 R7 H' b* N8 Q" Z- Y+ J
- x, K9 H) S9 t$ ] Jif (iedom||document.layers){$ y: _' f/ S Q3 v- E) }/ K1 R7 P
with (document){
" ^" ~& B3 z A: I1 o, {6 @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& W" I% a4 l$ c) m j% [. s9 b
if (iedom){$ i/ {' M4 ^' U* E# z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 M$ B, k! h- @& [( c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: ?3 b, j8 S% ~" Q p6 L+ ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( V8 A9 q8 N {3 X
write('</div>')
5 X( j. L$ D4 P}
! o) C) W1 B: j9 }! `else if (document.layers){1 L) K% m2 f9 L6 ~3 k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) |/ H) g" z; ^' N9 z8 n, Q) d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" a0 |, k6 Z+ R9 d6 ?6 f
write('</ilayer>')3 x. v! r7 Y* d7 l! S0 Z* \( @* C" I
}
' D7 V0 F% A8 Jdocument.write('</td></table>')
+ ~. s y. r% j' W}- T& e& O/ S+ M
}
Z) e4 l% K. \6 q</script> |
|