返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ ?+ L0 \) ^2 ^var marqueewidth=300& g: N# Z. Y# R9 @0 m5 a/ W9 K% {
//高度; \' u# [, n* G0 f: {5 X& J
var marqueeheight=25$ ]7 V! u' N, Y3 T0 J
//速度(1-10)8 P2 \2 T. {( x7 D# {
var marqueespeed=35 n* r; F/ a. Y/ A) M- P( R
//背景颜色
9 {, q1 n! S/ j$ ^var marqueebgcolor="#FFFFFF"8 @$ \7 G! @! M9 W$ L: |
//是否能暂停 (0=no. 1=yes)?  b. P% m& @/ g# E, z% C
var pauseit=1# y# w6 u8 n+ V7 Y" z' Y+ U7 C  S
/ T( @% W: Q$ U0 P7 E6 o
//修改显示内容% D  \; p$ Y7 e: o& t7 i5 o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 X( L, T  R" F6 B2 h

8 E7 M* p8 x: O7 D0 W/ }6 k, A
  G7 T2 Z4 h) J- ~4 h9 ]8 }////下面不需改变////////////
1 g; s, A# O. {7 q) L" T9 X/ X
var copyspeed=marqueespeed( \* \* U# I+ A* |
var pausespeed=(pauseit==0)? copyspeed: 0
3 O4 n5 O& o4 I) tvar iedom=document.all||document.getElementById
6 ]6 @  `' h! {$ L0 T& {: e1 eif (iedom)
9 g7 d' S9 U& I+ O5 T' Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 Q5 h# \+ M, U9 Yvar actualwidth=''
* q0 X. s! l" h1 w3 m* D8 H# Svar cross_marquee, ns_marquee
- K2 y' a5 T' c$ S$ e9 B! p
5 e5 c- O- I7 |7 Lfunction populate(){
- @& k# M8 n) X$ U$ v3 H+ m/ uif (iedom){  n7 E: q' O( K* n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: Y6 c5 i0 r7 s; Z) K' Ycross_marquee.style.left=marqueewidth+8
( J( ~9 a# H: \: H  d' H1 |0 scross_marquee.innerHTML=marqueecontent: v! ^& ~  j9 b# h5 V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  k6 S; M6 }9 }  Y
}& `! L+ k* C6 e0 |7 C
else if (document.layers){
) G. E8 ?7 z; e. |8 ^ns_marquee=document.ns_marquee.document.ns_marquee2
- J. Q6 R# }5 `  W. pns_marquee.left=marqueewidth+8
* Q8 I# ]2 N$ ~8 o! n# tns_marquee.document.write(marqueecontent)
# @+ A+ M) K5 `4 Cns_marquee.document.close()# U/ \4 t# ^* e
actualwidth=ns_marquee.document.width2 v& c) U7 p8 p. \# S, K
}
$ P. I, ~0 K/ h4 U- d; j4 [- p" Qlefttime=setInterval("scrollmarquee()",20)
" o4 j$ \5 @; J; B' j6 @# t}+ |/ Y  C( E% T& J9 k  G# c5 V
window.onload=populate
) [  F% v) J- ?' A" y, N) J2 X# M% T" s" }& p6 _
function scrollmarquee(){
: ?( x( }8 O! g7 E" [0 xif (iedom){
3 m/ p- i% @- S$ l0 v8 I  Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" v+ ]' m' R" y5 [. M1 hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- U) G- H' v/ w- q. |- T, Q9 w
else
) c$ ^4 c' M# y" }cross_marquee.style.left=marqueewidth+8
* W5 y: i4 ?, F8 `- N6 q; [/ i8 I2 d* N0 \' p
}
5 C* x; V( {& L7 J$ belse if (document.layers){
; m( Y! H1 `* bif (ns_marquee.left>(actualwidth*(-1)+8))
, k: ]% |( X! Q7 r6 j6 J$ wns_marquee.left-=copyspeed
$ p! N" n. q! h6 M4 p  ?! xelse$ u5 ^& k0 @+ p0 B* c, Z
ns_marquee.left=marqueewidth+8
% A( o7 c0 J" }7 \6 S7 B}
' d4 D4 P. Z' f& s}& y4 x/ V: A3 L& D4 k. b0 j) N
- s1 c/ u0 p2 M& I4 G  Z$ j
if (iedom||document.layers){
" i( o8 h9 [* S5 jwith (document){
  q& R2 l3 q8 i+ K1 Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' n5 }- x; _7 q! i9 ~6 pif (iedom){! L5 i) h0 i% i: H+ ]% z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 W3 F, {- _8 r, e0 m0 J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# k0 m2 f2 j3 U& \" N/ qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 D2 [! J9 ?# m# q0 i
write('</div>')
( s, p, g0 j( {1 g}
2 _, ]2 z% z$ D, ?5 d, telse if (document.layers){
; R; h  t  [& [; {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ h7 y5 E- }/ v. u' s. E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, Z) Q3 a0 l* B! H6 a3 q! L' awrite('</ilayer>'), Q. s7 v1 w6 G: R
}
  H! }! [! V- ]* y; u( q/ Ldocument.write('</td></table>')" d' R2 E) Q0 l( D  @( ~
}" z3 R" _9 b" O' i
}
* A( g. x  @/ b: ~* a. h( L* C' S3 d# T</script>

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