返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 w8 _8 T/ k. p+ K% @var marqueewidth=300% s" }5 Q# m+ S8 M% ?1 i' k  @1 Q
//高度4 ~- r! o: u; P
var marqueeheight=257 b4 l; Q+ Z' d5 P6 S
//速度(1-10)- x0 G4 M7 k. H8 A
var marqueespeed=3
. w4 M% g/ x6 c" F//背景颜色
: Z0 s0 |2 `5 i+ V/ svar marqueebgcolor="#FFFFFF"
# p9 X$ g1 H: Y2 c" P//是否能暂停 (0=no. 1=yes)?5 G4 h! V/ {1 a
var pauseit=1/ j- }) K" F: J2 x! I
4 n# [5 r, H- Y$ p; c* _
//修改显示内容
- u* j; ?; Y$ S5 F( T; U# wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 V/ }8 A- o$ y; H

5 H- Y9 U# n$ Y6 G
6 D8 O( u% K  N5 x5 J( }# v6 t////下面不需改变////////////
: e( q0 a- r& t+ |* H
5 ^( j6 |( u0 K8 {* m  C4 Ovar copyspeed=marqueespeed* B: ~5 m1 O4 f) D2 ~) k8 ?- w
var pausespeed=(pauseit==0)? copyspeed: 0# Q) L( z! B7 [7 ?
var iedom=document.all||document.getElementById
3 C# X! e3 R9 g; J& x% F" O; Aif (iedom); C; b( z9 v- u& @$ K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 o% g) y5 @1 h. x# {' Lvar actualwidth=''4 X$ t/ ~* b5 u3 a
var cross_marquee, ns_marquee
, d4 s, G. W! i9 ~
5 a0 b5 y1 ]: A; ~4 j7 ffunction populate(){* Z9 v( m5 [; S" d9 E0 }! A. h" a6 S# A
if (iedom){
4 w6 U% ^0 O" r8 C' i* ?) J1 ?* mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* v2 J+ u: S1 ?# |' m
cross_marquee.style.left=marqueewidth+8/ _; V& R+ P, W% o% e% _, n
cross_marquee.innerHTML=marqueecontent
! |2 f& Z5 c) i# O) \- J. Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 @; T& Y# e6 e+ _3 M& D- u}
; A' t' K( g9 v3 L& i* Kelse if (document.layers){
9 B) ?6 Y: I# q7 c: Vns_marquee=document.ns_marquee.document.ns_marquee20 {% v, v- M# c
ns_marquee.left=marqueewidth+8
( A+ l3 U/ P8 `1 p: q6 uns_marquee.document.write(marqueecontent)1 f4 x; I  o: h* C+ W* [$ s6 k
ns_marquee.document.close()
; X9 e4 q6 }: u. T1 jactualwidth=ns_marquee.document.width
* Y& [! j# i4 }}  l- v  w  P$ f  \
lefttime=setInterval("scrollmarquee()",20)
: d1 L. k/ T* f! Q, c}
) p1 D0 ~( M) p" o# P+ mwindow.onload=populate2 c. q( Z9 `7 N9 ?4 f# Q

/ y5 w* d2 j' L% O7 @function scrollmarquee(){
. j9 ]' I, z; d! Fif (iedom){
# E* O$ Q' z( r1 gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ Z, \4 F9 ^7 K( kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# W1 ~; ^) v; |
else: _3 @3 s) a& u) O
cross_marquee.style.left=marqueewidth+8
, }" f7 Y2 U4 y1 R! ^  y
0 f0 D& X: q# W  v. t. g}
# z" r7 Y* R- q2 e! x# r  I7 \# gelse if (document.layers){
  z0 G  ~4 q! v" \) ^! b$ Fif (ns_marquee.left>(actualwidth*(-1)+8))% {4 O. z( ~7 P9 L$ _2 V7 W& t* ]' A0 K
ns_marquee.left-=copyspeed
$ ]" G- s/ V" X- G  y2 _4 f7 [else
# ]" |! [/ ]) ~# h% w: Z; ^% ~ns_marquee.left=marqueewidth+8
0 j2 T. X% @* q  U/ {# |" _}8 T) d# k, {% K/ @0 ~
}2 c! h' f& Y% D; k. I: ^  M3 r/ q2 j1 o

6 s& ~! H8 w* ?if (iedom||document.layers){0 V. X6 B* ~8 o4 y% N4 |
with (document){
2 p4 |* ?5 R. jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 j" }- C! D4 wif (iedom){3 t3 ]$ G8 Q2 A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, c$ f  T& V/ r1 s9 S/ ]; ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" z, \$ C6 f8 f5 R5 O% J4 z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! {7 e3 m# S" d8 J' B8 Cwrite('</div>')
8 N. A6 G/ D5 y2 M+ }}
6 c2 u8 ?. h, Qelse if (document.layers){2 H  o# W2 H. K  P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ c+ C2 b& L" g& L8 v6 r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 y; @' ^. l( ^write('</ilayer>')
% g8 l; N7 Y' d. g}
& j: d0 e( u. m1 V5 D0 G" y+ x4 _  }document.write('</td></table>')
% k5 U; y9 K. s/ e$ h}
* H0 j9 y  B; f, c! D4 v}1 _$ X0 ]% a$ {' f# y* ?* u
</script>

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