返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% P  O! q( h5 I( cvar marqueewidth=300
& C- P  S8 Z/ C$ ]3 m- A3 B3 c//高度
  C2 @/ z8 b# |% `! T+ ~var marqueeheight=25* g! q2 M$ D: w& q8 n& A4 J
//速度(1-10)
5 C1 E. \. h9 C: ]var marqueespeed=3
6 p8 i# k% P, o! F' q//背景颜色
+ b8 |$ s5 F5 wvar marqueebgcolor="#FFFFFF"7 n8 t! t! g0 z
//是否能暂停 (0=no. 1=yes)?
; A+ u/ `) ^- E# ?& N4 ]4 {2 `! Cvar pauseit=1! C7 t8 o# V( r1 ?

  u+ O- y/ q# j' b9 ?' S. f//修改显示内容! i  \7 m$ i# U7 g' S: A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 y; s0 E  n/ |2 }& D

" h9 F5 C- v0 S& w6 x1 J2 _& T( i
////下面不需改变////////////) E' s) O; @- ~2 i# @$ s' X

& P- o# a+ T: _1 I' Gvar copyspeed=marqueespeed( ^! s9 n% c7 T0 W
var pausespeed=(pauseit==0)? copyspeed: 0
# E# v2 N1 z: c5 k+ uvar iedom=document.all||document.getElementById
% }6 ]% w* I0 v- G9 ?' Iif (iedom)
. d2 ?' a2 C. k! t/ C9 _8 Rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): j4 E; S: o) O
var actualwidth=''
  W1 `- E4 }0 C0 q( f+ a) k( Y( @6 a* S3 Qvar cross_marquee, ns_marquee- v$ N6 j; ~9 ?
' j) G) W  P5 ]' i; ]6 y
function populate(){) m- h$ g& @# G9 Q/ ?
if (iedom){
' o" h; @; D: K, C- ^: F" W! E' Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" L+ P3 f8 K& V4 s# K
cross_marquee.style.left=marqueewidth+8
5 ~" [* g5 n1 n* [- Ecross_marquee.innerHTML=marqueecontent2 {2 |) g- p: x6 w; R  \' ]" u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; w' L( B0 p2 T+ l% t. l( l! @0 B) a2 P}
( u) J" \- e# y7 ^6 `0 b6 F) q7 jelse if (document.layers){
# d' P3 U, J3 u; u- D* g( @" W( \ns_marquee=document.ns_marquee.document.ns_marquee2
  B" a0 r# Z0 K1 d; M; }& [+ f0 @  e; Tns_marquee.left=marqueewidth+82 x" n1 B3 z" C! [8 [
ns_marquee.document.write(marqueecontent)
+ P: ~$ x0 Y( u; r( {5 H5 Z, ?ns_marquee.document.close()
5 p6 j. X! U4 g: g" jactualwidth=ns_marquee.document.width8 j9 [( }# J' Z
}8 {0 K# v+ S( B8 W2 [' O
lefttime=setInterval("scrollmarquee()",20)
9 r( f8 Q( p7 }8 E1 Q( {2 U5 W. o/ g}
; J9 n6 O+ p+ t1 ~: c- uwindow.onload=populate: _7 ~( N5 s) B+ @* b2 n
/ H' q6 ?5 `# Z6 A0 v6 d
function scrollmarquee(){  S4 ~" w+ g5 s( c# m
if (iedom){7 c+ ]/ |* ?# x+ q! Y# U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( N  s9 Q6 k. {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ D  N3 k& N7 P5 H7 {
else
( ?! P) [  `3 Fcross_marquee.style.left=marqueewidth+8; m9 Z- Z) O" f* v

. a2 l  i$ V2 t: q5 D5 J* w+ j2 |}$ h& L& V. i0 c8 L' V5 w3 b
else if (document.layers){' \$ [" ~0 e( f
if (ns_marquee.left>(actualwidth*(-1)+8))# E3 x3 l" [0 c+ |
ns_marquee.left-=copyspeed! ~* ^( ], W& J. |3 \/ J
else* s# B2 \# i2 n# q. T8 E/ P6 c
ns_marquee.left=marqueewidth+8
' s" D. b0 p+ m}) k5 r7 V0 y" z# x6 W9 d6 g: {* I
}/ t3 i$ B5 i5 B

; M2 \% O! f0 \2 Dif (iedom||document.layers){: ^2 }" [4 ^5 l# Z% N
with (document){
% s: q2 Y5 K" e* i# ]' ?2 z) tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ ?$ {5 o# U! r* |+ f+ vif (iedom){
  m3 e, X  Y% Q" x" Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  o2 W6 s0 P& }" jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- l, C* |  i2 p8 ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# S1 k; n# d" ^, z
write('</div>')
1 ]  C$ A8 P4 e* {}# W9 N0 r+ q+ d8 r2 n
else if (document.layers){3 [3 y8 \: P# ~& V& K, i7 R7 s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 B% {2 G7 k2 n* r* n4 b  ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 _/ f7 F; L" S9 h3 B& R! l: c3 M
write('</ilayer>')
$ x- S2 }4 e9 ?. x5 I+ G' M# Z0 C}* l( g7 ?1 ]1 j! m1 \
document.write('</td></table>'), l7 S6 D. o2 @# `+ S
}; w4 m5 [0 F: N+ S4 v5 T
}
! e8 Y# _  ~) T8 O/ f</script>

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