返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; L5 X: w8 N3 r& {3 y0 `( M( D. f8 Hvar marqueewidth=300
$ L8 R  Y" |- @9 v" i. G//高度! N2 z0 L, v; ]; v& i
var marqueeheight=250 z, G% W8 X9 ?) o
//速度(1-10)$ o; S9 b; U+ |0 ]0 u& N! ~3 t
var marqueespeed=3
& Y4 m# ?% e8 ?9 o. @$ J/ H//背景颜色
& \+ @( r$ _9 `var marqueebgcolor="#FFFFFF"
) F2 b5 W/ Y) z# a& m8 m4 F//是否能暂停 (0=no. 1=yes)?3 S0 o3 A+ R  y/ ^  _1 j! F
var pauseit=1
8 x6 y" [' _: Q3 l; h4 u, @+ `9 [) s+ j) i# a; Y1 I# u7 K) b  Y9 L
//修改显示内容+ X1 R/ o1 Q& s  |$ N- g0 w4 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# k: P' Z! M0 a1 d# h: d

' L: {6 J" X! Q. A; c
7 V5 l, n7 ~# Z5 U+ Q% ^6 g) V' U////下面不需改变////////////
( i" ^4 z$ P4 K$ s% u4 N- s( y1 U$ s8 L) E6 T5 w, Q
var copyspeed=marqueespeed
3 D8 v( K" C/ A% H/ Q7 C5 a* Tvar pausespeed=(pauseit==0)? copyspeed: 06 O7 {4 W; q' O7 Y2 K" M( |. J* U5 K5 k
var iedom=document.all||document.getElementById( u" t+ @! l5 A1 V2 m
if (iedom)5 b7 m/ b: I" i' r5 O9 ~4 C( s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' e/ |0 a) i5 D1 G) Z' }var actualwidth=''  K. l8 h2 r$ D9 o
var cross_marquee, ns_marquee
$ _) M; w' a0 e4 m- W2 ]  O' M' r9 J( j2 G- A! g
function populate(){% |; }! O. r4 p' E& L1 m
if (iedom){
9 f: l' f5 V) f. u$ S$ Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' f. |4 l# z' a& ^! x0 ~3 T* Q
cross_marquee.style.left=marqueewidth+8
) p0 F$ A0 z% l8 Q: O* vcross_marquee.innerHTML=marqueecontent
3 y& c/ l  X; H+ ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 F# [" {. `/ c' I7 C7 B% }; W# u
}: i; `$ x0 m5 b1 |( j8 N% v
else if (document.layers){) X2 L; n* G: G: c
ns_marquee=document.ns_marquee.document.ns_marquee2  A) Q# r0 e! z& {5 O4 P' h/ y
ns_marquee.left=marqueewidth+8" b1 X, \# m2 r) O. v
ns_marquee.document.write(marqueecontent)
( m; h% n$ ?: F4 z# y( Pns_marquee.document.close()$ e/ a2 ]" C1 }: |; ^" k; h; n
actualwidth=ns_marquee.document.width
* M9 d" {' N; `# V}
) s- v# ~: v$ F6 }" v* u) Elefttime=setInterval("scrollmarquee()",20)
, b* t; _! o" n, ]}' V% c+ T! H, }( d& {
window.onload=populate4 a5 |# K9 |/ I
- G# {- y0 o7 b9 [: ]) o6 V2 ]
function scrollmarquee(){
0 X9 Y5 R7 t6 e! [if (iedom){) c- f% V: R8 c/ v. |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# Q0 L* p% `* {) G0 x2 o) ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( |% ]. N* o5 Y  [) n
else5 ]" B- T# m2 S* q: I# h; N0 Z* v
cross_marquee.style.left=marqueewidth+8
  d) q. g$ c" ?3 b4 Q1 T* z. T
}: K( O+ ?# ~4 \8 v0 s& @" c
else if (document.layers){
% Z3 Z, |3 a. a; \if (ns_marquee.left>(actualwidth*(-1)+8))9 V# v5 S% W- `$ ~2 D% H7 e
ns_marquee.left-=copyspeed
5 e8 Y  |/ Y5 o9 i7 _  p" melse! m5 `& @# k* y
ns_marquee.left=marqueewidth+8
/ L9 a  |, w' a/ _6 d}
* o! c2 ~/ V  C0 c- z/ J}' |6 h" W7 x. N

* C& ^8 F0 l0 mif (iedom||document.layers){
" p" F2 k+ a# ]: }4 r9 ]with (document){
2 ], K" ~) x+ Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 e6 g6 q. _) h9 E2 J  {& ~2 S" y, Jif (iedom){" t% Y5 X3 W3 C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) y0 g4 y( S1 V5 W7 k/ Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ c2 Y4 L, ?3 g' f& l: T; cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 r% p& p7 ~$ ]
write('</div>')
* f& g% }  X( y* y* e4 t}
- e. n  b7 ]4 |4 ~- Q% S4 Gelse if (document.layers){
( s) C; `* }' h! Z* D6 \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* T2 n# x5 T( K/ c9 P6 a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ w3 E7 Z0 l' r, ~" ^write('</ilayer>')
" e( y/ f, y* e* R: R8 E) v}
& A' v( D, q" w+ V7 gdocument.write('</td></table>')
7 O# e! U  R5 g7 p}
0 K) |1 l5 C  q}
! ?3 {+ _) M. ^; }</script>

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