返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 Q  b+ x3 g) d1 ?
var marqueewidth=300  V+ A5 f) Z5 A- P, a5 @
//高度9 y4 K- V8 v3 B4 N. \2 J2 ]
var marqueeheight=256 z  @5 _1 i" i" D2 _1 Z+ e
//速度(1-10)
: V6 h  ~% n6 ?2 `4 N6 Uvar marqueespeed=3
% x0 U! `# x7 ^4 r- X9 a" l//背景颜色
- Z) j' F5 O8 p% Rvar marqueebgcolor="#FFFFFF"
. e! ^' E6 D8 F4 y& Z3 z# c2 O, F% S0 v//是否能暂停 (0=no. 1=yes)?
9 Q" V4 a6 {8 ~var pauseit=1
- _2 U/ e9 H) W" X9 T2 H9 O. c$ U6 ?0 o9 ?9 ?6 q2 F- d; L  k
//修改显示内容
( B& s+ V$ R* i; x$ K+ b( U% Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ p* [# n3 M- a9 H1 D/ M* v7 P6 Y$ j2 B; X2 g0 w

  c$ t/ v6 N" U# Q////下面不需改变////////////% o; t; J# A4 `" I, C3 Q1 h

" ~2 @6 R, M' l( x; ?var copyspeed=marqueespeed5 m/ C& V& ^# N2 n- E( W
var pausespeed=(pauseit==0)? copyspeed: 0& P  z6 B4 J" ^/ d
var iedom=document.all||document.getElementById: j% t( w! \1 o1 H
if (iedom)  b8 g; |3 i9 f( j' n" r- Z, S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) Y% b: B6 A1 {& A
var actualwidth=''
* p# n; [5 z* M' `* V% ^2 t2 a" Pvar cross_marquee, ns_marquee+ \  g. G: s7 b5 M, |* y* }" M

  k) j" h. ^0 ~: D1 @3 f% t* \function populate(){
( j9 o; k3 v4 h; C5 S; J2 \: \if (iedom){% {5 X. [) q. y1 ~1 e* Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ ~/ r7 T" w; z2 I$ W6 }& S; ^/ `cross_marquee.style.left=marqueewidth+8  K) V3 |; R0 l7 j( s
cross_marquee.innerHTML=marqueecontent
' m$ p8 C! }! z0 {' Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& x7 Y  T0 `+ a* \! s7 Y}
3 K2 g  j  d' p# telse if (document.layers){
; \! l8 ?) h$ Ens_marquee=document.ns_marquee.document.ns_marquee22 |, L% Y; p6 B! K. v" _- H
ns_marquee.left=marqueewidth+8! A. {# `, P9 j- Z# \
ns_marquee.document.write(marqueecontent)
& S3 D2 M1 B1 u0 `ns_marquee.document.close()  ?' b- E: |# ?' `. q; u/ ?
actualwidth=ns_marquee.document.width7 Z$ W5 M1 k7 a* ^0 v# [
}, H* d, X4 i. M! F& y  m# o* S! V
lefttime=setInterval("scrollmarquee()",20)! |% L: R' m- o8 z: e9 S) D
}
4 v0 p7 |+ j/ _7 M& ]: {! ?window.onload=populate* H4 t+ C5 H( y/ ~2 R  l* ]8 I
6 }6 l+ U. `- ^2 P! x# U* s. ~9 O$ T
function scrollmarquee(){% u0 b3 a6 A5 r# u5 W8 _
if (iedom){
; Z& X/ \: F; R" ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& I9 x& C$ @: n; j& R1 p1 {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 v# G% g! D' o; B
else
, Q7 C6 y1 u( J/ J: Ccross_marquee.style.left=marqueewidth+8+ f9 e3 p! C! R. T

, d; i5 U% o& o. o}' s6 F4 W9 l& w% A: Z
else if (document.layers){! d* Z, y' }% V; V$ _+ H8 N
if (ns_marquee.left>(actualwidth*(-1)+8))
8 w( W6 W/ l( j. c, ?ns_marquee.left-=copyspeed' u5 ]$ d0 Z: c+ j3 ~2 C; L
else
+ S" |; Z5 U, \/ g4 [ns_marquee.left=marqueewidth+8
" d5 k# ]3 P! L4 z' P9 i}
: R3 W* f8 F, u2 g. x/ C6 Z}2 j, g( S( G; b  x# E

* x7 x8 a0 w5 `4 ?# T1 M+ iif (iedom||document.layers){
0 X7 o1 J. J6 c- @. A, {! \' Twith (document){5 ^2 r$ o7 a1 G' E
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 w! L9 f* e2 Y& N5 ], Aif (iedom){" h( w& w% G% X1 f1 m4 e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* h; u- P, K0 ~1 Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! A+ E# X6 [7 V$ w- z+ @) \. owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 s, T& l* ]9 A3 A
write('</div>')* [' D$ T" ]- U: a; ~- J
}1 I3 D3 e/ V& a: ]8 s
else if (document.layers){
) E+ N  f! C& i+ G6 O! E+ I+ owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( h$ H/ k) F% z2 `5 Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( p2 t# C2 X% x- Pwrite('</ilayer>')
# s* x3 r5 I* r: E( J" M  ^7 b' u}0 D2 d  y5 ?! k$ y4 {: i
document.write('</td></table>')
: D7 m/ f8 C1 ]+ n, ~/ c}
5 k4 H; g8 @$ r8 K8 o5 e3 k}& d6 Y+ ]: m2 s" x7 y
</script>

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