返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 m+ R3 P* |& p- F, Cvar marqueewidth=300
( \# T( T+ J# _//高度
4 i- }4 G6 i6 O* O" O6 Z$ Lvar marqueeheight=253 Q# c  M; v/ j' z* {- d
//速度(1-10)
1 l6 g9 i2 k/ x3 Evar marqueespeed=37 C6 ?, N5 o6 x1 ?0 G) {
//背景颜色# _) l# {& I6 T% C
var marqueebgcolor="#FFFFFF"
; t5 S. `+ O3 z/ W- V; {) b. B//是否能暂停 (0=no. 1=yes)?; q6 Q5 u# O* o& y( z. A: K6 ~
var pauseit=1+ T  B: ^! \1 E! P, o' {

3 ^' T( c2 O, G5 y# |9 @//修改显示内容( a" V1 w3 p# {0 Y4 K! U. f3 ~# c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ A, |: b0 P6 b: t+ R: [

! ^7 e( _2 G$ K, j4 E9 ?% S
; ?- `& T* o5 m  R+ \1 G////下面不需改变////////////* v4 N9 I9 `* j$ V- F; q9 u1 Z
$ }1 C8 t4 M: x, Z1 i0 j! {
var copyspeed=marqueespeed
( L; U% N7 E, r( f: T. ^& D% [( ]7 evar pausespeed=(pauseit==0)? copyspeed: 01 a( E" k* \( G( r6 [
var iedom=document.all||document.getElementById
5 l, l2 K# p0 N; F5 Z& t  bif (iedom)2 G( N  r5 T8 c# r& t. g$ ~- o% W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! ?" u5 Q) n! ?  [4 h* lvar actualwidth=''
/ v) V* \3 ]4 B# gvar cross_marquee, ns_marquee  g9 \, I" N; Q; H9 f; o. H

. E. b5 p# M# F6 u: B6 wfunction populate(){
! X3 S' u: s) M: @# o$ Uif (iedom){9 T  }; }4 ^2 T  i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 C. H! a1 b/ Y* o
cross_marquee.style.left=marqueewidth+8
4 M2 d# I$ D9 H, Ccross_marquee.innerHTML=marqueecontent( X5 E6 Y4 M' d0 d1 j' Q8 }+ F( M  E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: i0 ]9 h/ S# q0 ^7 q}
! P3 Y% ^2 `. r* z0 lelse if (document.layers){0 b9 `( h7 [: E9 D0 a. d2 a
ns_marquee=document.ns_marquee.document.ns_marquee2
5 e( q6 J' `) r7 g0 w3 bns_marquee.left=marqueewidth+8
5 b: k+ s7 w- ?) u# G( c/ n$ {ns_marquee.document.write(marqueecontent)
" {8 C( U8 ]' c. _; zns_marquee.document.close()/ B( H, F  E+ D
actualwidth=ns_marquee.document.width
. c# U+ L  u) }) j8 e}
0 c" I" h1 B& H6 g& @* l" B, Llefttime=setInterval("scrollmarquee()",20)% S. e1 \7 e7 Q
}
+ i8 m" I) O" e6 e! Owindow.onload=populate
3 b# ~! _! ~; [7 S" ~" X
" }' Q! H2 ~/ w5 x* Dfunction scrollmarquee(){8 p! _1 ~' g+ e  J* L
if (iedom){
5 A! {, r& x' wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% ~8 g2 {1 m) N# J  m! }! y1 b9 I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 u+ m" h& v( j7 ]' o+ e8 \0 a
else# i: j9 {3 c8 L3 U% n4 M
cross_marquee.style.left=marqueewidth+80 f2 v; n# R7 ?( V1 d
; M. D, m( z1 \0 H5 ?
}) |( n0 a! z, `% c9 N! L, P
else if (document.layers){4 Y9 c# G. V7 W
if (ns_marquee.left>(actualwidth*(-1)+8))( X! p% s8 i" P) R2 v7 ?/ U  p8 v
ns_marquee.left-=copyspeed( L( |: F  [* K
else
: R& ^# }+ T8 I" l2 k8 hns_marquee.left=marqueewidth+8
1 b2 _" K' K; C$ E8 D. @1 Z! r( M}
% p; n; l; S% M, y; R}4 X. ^4 A* E: Q) Y7 n
4 v; H% S- |" e, ^. z: S) X
if (iedom||document.layers){1 ?6 s( g# ?( Y$ @( y, P
with (document){2 O8 ~; v* K7 T2 f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- g4 \. T5 D1 t( p1 g2 G9 Xif (iedom){6 Y! z, E* C% y; v3 R, ~4 F1 |7 z1 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). b/ ^2 f: o7 z) b. z! f" ]
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ S2 s. \2 Z! y% C; K. s3 v/ hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" W7 {$ W4 w4 k4 m1 T) i
write('</div>'). @  o' m1 Z( S" T! `. i$ [
}( V: M$ C5 x5 U/ {
else if (document.layers){% X5 q5 U1 `% }" J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# G2 ^; `( t( f" G9 f" Y8 c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 e- z; O+ v1 c: @* D
write('</ilayer>'). K( F8 o0 [( y
}
+ J% y2 }) f" v2 @document.write('</td></table>')" f7 [5 J! F6 g6 ~3 g
}
5 j% Y7 g- o/ }( b' y}
$ d& v% P' Z4 z0 \8 W</script>

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