返回列表 发帖

网页之跑马灯文字特效

//修改宽度: j9 S) Q1 q1 V5 s
var marqueewidth=300
7 ]7 n5 G" q1 r: c; d: }//高度
* {9 k' o. N$ l- K( z- u* hvar marqueeheight=25- Z' w4 g7 A8 u, i+ D9 {# l
//速度(1-10), M% x/ A& i+ t
var marqueespeed=3
# z  Z; s! ~6 Z$ a* `# v//背景颜色4 r/ b, A& b8 F$ T6 A) s$ @
var marqueebgcolor="#FFFFFF"$ r! W6 m! {* n
//是否能暂停 (0=no. 1=yes)?
: x- |$ ?! [6 cvar pauseit=1
% @# s* t, J* x; g/ i
# U) q; y2 }$ l+ m//修改显示内容* e; P/ o9 |2 e+ t4 k: B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ Z: J3 Y( k! p/ G8 O" R0 Q& E  Q6 P) d2 n1 \; g5 v) s% x
( S2 {# ]' Y" C% @, c" o
////下面不需改变////////////
# P) b7 C: I8 |& H2 ^9 [
3 V2 t/ Z; W8 i8 t. Uvar copyspeed=marqueespeed, F0 _. v) o/ C! k, ?
var pausespeed=(pauseit==0)? copyspeed: 0
* y1 D  I, H8 Z; q; a: f# d  gvar iedom=document.all||document.getElementById6 L/ N" j4 j! A- g! p
if (iedom)
8 z8 [! H  G) S, Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) t; f( e" M# W* z" J9 e, u( V+ Dvar actualwidth=''7 m/ ?7 U" K6 j
var cross_marquee, ns_marquee/ i& H$ I8 x0 u2 [% ~- v0 I6 h
$ f* }3 ^, T( B8 D$ u6 f% L3 }8 P
function populate(){1 X; ^) S6 N# b8 f' `; J# i- B
if (iedom){% W( n' y; K. ^' E4 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" i7 J& }% O' u
cross_marquee.style.left=marqueewidth+82 \( I7 [. P8 m1 S
cross_marquee.innerHTML=marqueecontent
, B9 O2 N: q/ a5 {( ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 ?+ d- S* Q: z. ]7 L
}
& P- N# {' y- K# a5 q2 q0 B' telse if (document.layers){
# g3 o2 u, b# Y  B9 c6 A" r1 T% G0 Cns_marquee=document.ns_marquee.document.ns_marquee2
3 c' E  S# b' J9 C! B! ]5 Q0 uns_marquee.left=marqueewidth+80 l* n+ q1 U2 T# k3 R9 l
ns_marquee.document.write(marqueecontent)
1 X. I+ n& _; Y& H6 \! P# lns_marquee.document.close()' H- H; [" T  y9 c1 o: Q
actualwidth=ns_marquee.document.width
' T& l' y7 h- s6 O+ ^}
/ o: s/ X  g+ O  c: mlefttime=setInterval("scrollmarquee()",20)
: E+ X8 K% {8 f. n! B" l* m}2 j) Z8 C" I$ X7 R5 f  [5 x
window.onload=populate5 D0 n+ I9 y. }) j/ v1 @7 d

8 k! b/ _. L, ~( [, [  Y( Ifunction scrollmarquee(){
7 }2 u" U3 c$ \8 [. sif (iedom){
$ C2 a" H9 a! W8 t# Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 ?3 M+ v- ]7 N& U0 @  F$ Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) Q! M, n6 L  ?0 S2 a5 u, Belse: X. b5 r- Z1 Z5 ?& \+ {
cross_marquee.style.left=marqueewidth+8
$ ^& K9 w- D: N$ Z: A7 n4 i- J# ?
! @4 i1 `. l' O) P. S' O}
' y7 N1 Q5 i" K- P9 Y) Felse if (document.layers){; Q: \( Z- d  r6 c, }) O
if (ns_marquee.left>(actualwidth*(-1)+8))
8 L& q' ]* T' M* @( Fns_marquee.left-=copyspeed- \7 u! \5 L8 n9 Q4 q# T
else4 Z0 ~6 S/ ^8 ~) v
ns_marquee.left=marqueewidth+8" s9 u" O- V4 `: C6 D
}
6 V7 E, s' K) {# t3 h7 R1 |}& g2 }, v, P" U( Q- C
3 v0 N, Z6 D0 c, e1 a
if (iedom||document.layers){+ ?/ P" ?# G, Z+ ?5 q- ?( ]% c
with (document){# ~2 e& h" K$ u; b3 n% g* J( j! n% C/ ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% ]: m! R3 P/ J0 p/ [( R4 g
if (iedom){
* d9 ^% j  Z& x3 U3 k7 g+ d# _- Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. P! |6 z# S' Z) C, v$ F, ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% t) U8 g/ f) J# P% d/ N! _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: Q5 E% ^) p7 I3 Nwrite('</div>')
; Y7 w3 g* g: U}- k% ^+ \: R1 |- @- V
else if (document.layers){0 w$ B* R3 c! V" V8 e; x3 X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 o2 J; @2 K6 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. w; z4 g# ]; H0 R1 E; kwrite('</ilayer>')9 X- E) ]+ N! a% ]
}+ I7 R* A/ t5 F. y3 ]3 [& Y" t
document.write('</td></table>')/ L0 S; C# ]! s* G5 Y, d
}
% I; X" ~3 j; B* J  m# V! f0 Z$ i}
1 h$ H$ E0 |3 s1 {! `</script>

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