返回列表 发帖

网页之跑马灯文字特效

//修改宽度; `% X( g0 j% A9 a  t
var marqueewidth=300) w7 F1 m0 p! I1 C
//高度) @2 T% A. w( j/ Y" [
var marqueeheight=25% R5 C$ t0 \- X: c( R
//速度(1-10)
1 i* T6 C5 W, O- _var marqueespeed=3; a& E+ F. `+ W* T# G  s
//背景颜色# o+ x, {. L: V0 R
var marqueebgcolor="#FFFFFF"2 {9 F" E6 r- y3 [4 u6 O
//是否能暂停 (0=no. 1=yes)?
9 l  _, Y6 K7 J( _' x! I2 c9 ?) ovar pauseit=1
: N% A+ v/ }4 w4 C- r2 Z- _, [& K4 h# J6 Z' ^" Y+ _4 g+ g
//修改显示内容
! a' J6 w, H4 J( t! q) u( avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 ]4 A/ u  |6 M! }, N
* M+ p7 R! @$ ~1 D% c# [4 ^( U0 L

# B1 W" R) @% J8 J0 p, k2 h( G. D////下面不需改变////////////# V7 m. o! O3 _

7 p) r" z8 P$ g2 nvar copyspeed=marqueespeed6 p6 k# l. Z' ]4 ?' x4 _
var pausespeed=(pauseit==0)? copyspeed: 0
/ X5 u5 C4 S9 d, c0 t1 j" ^4 [var iedom=document.all||document.getElementById
" y& `1 C1 x' G1 R9 r* o# sif (iedom)& y% q/ w" G6 Q6 t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" P; l8 k% U: i! p# ]! r
var actualwidth=''
% s( Y0 J- ]$ ]! k7 hvar cross_marquee, ns_marquee8 t4 k2 @/ [* U8 R: r6 l# T

( c7 k( i) D$ R# q% i% t& Gfunction populate(){& g6 l4 v5 p1 Q! e# h# F
if (iedom){% l/ X/ z% }* ?- i8 c; P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 J5 }) N2 _* @$ q5 c0 C
cross_marquee.style.left=marqueewidth+8
3 M: }# z, P' gcross_marquee.innerHTML=marqueecontent
6 Z; B# O+ D" d- e4 N$ gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* f! ~1 {. V5 w2 ~5 U* Q4 F
}8 W8 g; k, [) O
else if (document.layers){
. Y5 x/ n  `3 v; |ns_marquee=document.ns_marquee.document.ns_marquee2+ n9 ]; G. x! R: j
ns_marquee.left=marqueewidth+8
4 o/ r( f) s+ u, Fns_marquee.document.write(marqueecontent)9 c, t; }8 B9 t2 r( @. T/ r. W( \& e) p
ns_marquee.document.close()4 F+ m7 y# p+ A
actualwidth=ns_marquee.document.width- |. q' H% m; U" @8 |. `
}$ }2 o+ \& y. n. v  `
lefttime=setInterval("scrollmarquee()",20)
% p- w' ~& F, g' L}
$ B3 F4 S2 n! E0 Z, j% K4 P0 E8 f! u0 h7 Owindow.onload=populate/ O9 W1 J5 P+ N% u: X- Q
2 _) {) F" u: h) y
function scrollmarquee(){
  S- K0 Q7 h4 E0 b' jif (iedom){
# Y) f) _7 l7 I% @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 A1 F; B6 k  r8 w0 W7 F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; W. J2 d5 @# y% c, n7 u
else
) K. l0 q! m. {" ^6 T; tcross_marquee.style.left=marqueewidth+86 o7 t2 B6 [! }* T5 ]
' V$ d6 g0 J. h! [# u( V
}: L" C! H( q: }5 E. x
else if (document.layers){
; k0 {9 X" x5 A% I# e4 A9 l4 Jif (ns_marquee.left>(actualwidth*(-1)+8))
; _4 J- Y* k" c) H" f, c3 S6 d" vns_marquee.left-=copyspeed
# |) f# Z( y1 R' h' D" Telse; q# X$ S% s/ A
ns_marquee.left=marqueewidth+8+ P1 j4 [3 l7 o" O( I
}7 i3 ?4 u( T3 B2 a, V! f
}
! j  p$ R( z, s7 f4 T
) t) }, x! [0 Q- Wif (iedom||document.layers){
! V/ Z# E) H: u9 R7 Q3 Nwith (document){0 U0 y6 X  n/ X4 G# E. ?0 n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 i1 I( C' }- S9 z
if (iedom){
, V/ e3 y/ @( L8 awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 \! H4 l6 D; ]% v6 u; {' qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 A, ?/ o3 P, |" {. F! o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 F" ?1 n- L* W+ V6 M, ]8 N* p5 j
write('</div>'), S4 @" M5 u' \5 S
}/ c8 n- {9 ?' l2 U  H: b
else if (document.layers){
( x& S% x4 m- M8 S* Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( }" K  n* L7 b4 K( U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 {$ T( H; ?" x0 O8 r
write('</ilayer>')
! Q! a  B5 M2 C  @! d8 [" r3 Q% R}' F1 m( `" @1 N& l# W4 o1 Z
document.write('</td></table>')% I( T+ t7 b' U9 `3 @7 N( Z
}
' g6 C7 Y  }( C5 {}
+ ~" U  a6 A3 E</script>

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