返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 V* p6 s, K/ U: V; u5 s; {+ P) qvar marqueewidth=300
, ]; D, A0 H# b5 @! ~0 S//高度  E, T0 t- Z, {' H  s% }
var marqueeheight=25
" J7 p: O/ k+ L' D1 q//速度(1-10)
* |% d8 s( f0 E7 Lvar marqueespeed=3
! C( d# `) \9 c$ C) d( @+ p//背景颜色/ w& c0 F0 Y9 Q* c; Y% ~
var marqueebgcolor="#FFFFFF"
" Y  t# Q  b' S6 n0 a//是否能暂停 (0=no. 1=yes)?
+ R( g# j/ z+ xvar pauseit=1
9 a# _* M6 X& Y6 i, i% _1 \
: X& C0 J  @. F0 P& }9 e//修改显示内容
8 l0 _* s$ ~3 x1 L; b2 |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" U' z) |- F1 g  b& @  Q+ K1 x7 C4 t) l8 V" S

. s9 w4 j1 \/ R; I  h- a- _5 }////下面不需改变////////////* ?/ R$ Q# @  H* }/ p/ W* t

- m& g* `1 M# L5 ^0 Cvar copyspeed=marqueespeed
3 ~2 J+ x4 }3 D/ q+ M/ ^/ Nvar pausespeed=(pauseit==0)? copyspeed: 07 j  G/ C  n+ ~6 p# B' q! t9 V
var iedom=document.all||document.getElementById
1 o3 j) T# \2 \7 |if (iedom)
7 R( n+ A- B5 h" K6 Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& }( A/ W$ G) y
var actualwidth=''! b$ s% r- Y# M  H" I4 a. p& ?
var cross_marquee, ns_marquee
( f1 E& F& r; i2 p/ v! d5 X. j( V/ A  U8 F# R
function populate(){
7 B+ T* R% u+ t9 Z2 Q8 N1 Bif (iedom){
8 M% M4 P- F. l1 N( b' fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 m3 `! Z6 b) e( G% D
cross_marquee.style.left=marqueewidth+8
, m/ j; r- g6 c0 ecross_marquee.innerHTML=marqueecontent
! e5 h  s- @% P! s$ k- \7 Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ q$ F- E& H. l# x, l* y" g* u3 P}
' k5 _8 B. x  D" R4 J7 S- velse if (document.layers){7 V; \, I1 p* T' H" R' j  N. K, K3 c
ns_marquee=document.ns_marquee.document.ns_marquee23 n  t& o, \- J$ L+ w! W
ns_marquee.left=marqueewidth+8
- _/ k/ r5 c: Nns_marquee.document.write(marqueecontent)0 ^9 p* C4 n/ B4 B4 F
ns_marquee.document.close()
: n2 j/ E  g$ M; ?+ @( I" h( qactualwidth=ns_marquee.document.width) X2 L; f) W0 J, `: Z5 b
}+ C2 m+ r' l9 y4 Q3 V5 l' Z
lefttime=setInterval("scrollmarquee()",20)
0 g  B, ?6 k/ U- s}
7 V) [. V" h3 q* b0 f. ewindow.onload=populate
9 [" F8 P( ]6 P3 P0 F% h' N1 w- K% r1 l  g3 o7 o
function scrollmarquee(){
6 k; C7 U1 A% g, Bif (iedom){
" l) V) Z* n) _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 B3 U$ R% u& |, Y- r  B; q. gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* @+ J& H. Z1 U$ [% \7 xelse, u7 g7 y% k0 n" O9 e/ c
cross_marquee.style.left=marqueewidth+84 u1 S; E% I- N" u6 ?2 @
$ m7 H% y/ D. ?6 f# @& u- \8 |  |3 J
}( r7 |8 i6 O4 A9 v
else if (document.layers){
, ?6 b3 e( p5 N6 C# [0 O* Zif (ns_marquee.left>(actualwidth*(-1)+8))
* h* u% e/ e8 j& Nns_marquee.left-=copyspeed
0 {! l5 j/ q" q# |/ I6 ]else
* a. v4 S4 K' l) Q7 f/ O) b1 rns_marquee.left=marqueewidth+88 _" P. u& _* t
}
* {5 f+ t3 t4 l( e  a; b}7 ]+ B6 ?' u5 D0 i: F! g  e5 t: a
( O8 N2 F! H# n7 |  D5 o- ^5 Y
if (iedom||document.layers){+ ]3 N$ W% y# v$ g  b' V
with (document){
; Y7 R. j& Z0 _  e8 h5 bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; v  j4 X! e; f2 q7 R6 Sif (iedom){
$ [2 B/ |- {7 ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  |! }( e- ^4 P# k. Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! M) u/ u0 R4 G1 o/ Y; ~* awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), m( c4 v; d' x2 u/ S& J
write('</div>')1 b, o9 f! ]: b) u$ z
}9 L3 {5 C' B  D3 P2 x! N
else if (document.layers){
1 t! A5 x( m/ ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) L- W( w( @; V7 E' X) c- A$ rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); E& l9 F  A$ L3 g3 H4 U
write('</ilayer>')
: }9 \: w; U2 s1 ?) {" ~9 U9 a}
; W' I2 v$ E9 |  X, n! k* @; D; pdocument.write('</td></table>')- Z1 z/ N0 w- s( r
}
8 h! y/ {; Z+ l  ]" Y}
; b4 M' f- W3 ^" ]0 o+ v" o0 w</script>

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