返回列表 发帖

网页之跑马灯文字特效

//修改宽度  `8 X; _& q; ^" i7 v5 d
var marqueewidth=300' F4 Y' t- \. z9 c( h+ Y) b
//高度
9 k; x9 ]8 q8 p0 s8 L/ {! z: C, \% nvar marqueeheight=25
7 c8 L. D6 q1 Z, }) @//速度(1-10)5 ]7 t7 b* B6 @! ^2 H9 r: U- s
var marqueespeed=3
: W+ ~( h4 T1 a//背景颜色
9 e( D0 V& W# H) S9 }var marqueebgcolor="#FFFFFF") j: @. e2 A+ u  p' _: _
//是否能暂停 (0=no. 1=yes)?5 a. n2 _7 \: W! J8 R  P
var pauseit=1  g3 x' T9 N# k4 x

( @$ n  z+ }  r: i//修改显示内容# P3 Q7 }- K# B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* L, k) t# P  K% [9 x. z$ f2 Q# u
  }6 y- Z( ^4 Z) B+ X# _$ X
9 u9 _5 _3 {% ~////下面不需改变////////////
8 K1 n7 {( h/ N  m4 I4 G
4 b$ _- p: A. Z2 z3 ^8 n; e( R! |& X/ Gvar copyspeed=marqueespeed! R3 Q' W5 n6 `5 b
var pausespeed=(pauseit==0)? copyspeed: 0
, B+ ^0 i% o% h* S4 N1 yvar iedom=document.all||document.getElementById/ W( Q+ P8 _/ O6 X! R/ S' b
if (iedom)6 o) l5 |8 M0 J1 E7 {4 Z: U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  _5 n  f! a# G1 I" F
var actualwidth=''; s7 I; p) G# X3 K
var cross_marquee, ns_marquee
$ w# k6 b: c8 {* \0 V
$ V3 G5 K8 L! l. h( dfunction populate(){
* U5 \  `+ {. {5 x# ], _  [  Oif (iedom){
# a, n/ Q* j9 ^1 m! Y8 y, gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# K& m% y. B7 y3 F, y7 H- gcross_marquee.style.left=marqueewidth+8
3 @2 [* z3 C5 Across_marquee.innerHTML=marqueecontent! A- t  ]( l  c% j4 F. @8 d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# L5 ?' x6 q0 ^* \* F
}
0 E1 q. J( ]/ w/ S  |2 nelse if (document.layers){) Z# D4 _. C" _( `0 c7 C8 G
ns_marquee=document.ns_marquee.document.ns_marquee2
' U' V/ `6 z' }( t: c4 h9 ons_marquee.left=marqueewidth+8
7 ~6 x: g, `! H1 s/ ^2 @; ^2 dns_marquee.document.write(marqueecontent)0 D5 e; t# m, w
ns_marquee.document.close()
" j9 q; P  u4 [( |actualwidth=ns_marquee.document.width
# o( I; R: G3 B. s- m. ]- r}
0 r5 R( t0 d3 f/ @3 o/ q: Slefttime=setInterval("scrollmarquee()",20)1 M7 s- _) ~. \5 B3 O+ R
}
6 }% Q! Q) w" |) Kwindow.onload=populate5 ?" u8 s, X4 \2 w
; g9 P) b) b0 i( e- D7 F; R
function scrollmarquee(){3 h) p1 S0 V  s; d+ s% Z' X
if (iedom){
  w6 k+ p4 k- P. Q- A& Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 b7 _3 [9 p2 Y4 T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- S' D: j! J, M* ?( k$ L
else7 d% {4 {8 p* [' u+ o
cross_marquee.style.left=marqueewidth+80 a& w5 S* m2 c

1 K$ h2 ~$ b  Z+ H}+ u; g, H' K+ H$ D- o
else if (document.layers){- u$ l3 c: q! E. O" d; n) r
if (ns_marquee.left>(actualwidth*(-1)+8))7 m- A. L" H4 U4 E# C0 V
ns_marquee.left-=copyspeed, M2 {, x3 W- Z$ X* a+ Y8 x5 q
else
: l# x" W& Y& A% v  |ns_marquee.left=marqueewidth+82 ?- ]8 E: Q+ B$ g( D) C
}
5 B+ ~& C7 Y0 ~% H; f. N8 s}7 k, c+ v6 O5 O5 Q4 {8 {
3 W9 g4 J8 q6 o: V$ [
if (iedom||document.layers){
. s3 i% k7 s2 A6 W/ Dwith (document){
) I, S/ w) `, D6 g6 Q" zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! Q3 _4 D; |9 u7 ~% x0 }  B* F8 Gif (iedom){! }& o& f2 S3 u- r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  U1 V% Q& c0 c. R* |: O/ zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 e* J8 |/ x& Z: m& \2 h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. M5 N4 U3 m: u9 J+ Y) Xwrite('</div>')( _+ Y4 M1 q% J' |& p# G
}- r6 U* T* {) ]: Y( B7 L8 n, A
else if (document.layers){
( p9 p" C0 J3 @9 m3 ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 Y3 v1 F" c" h+ mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% s8 R& x& Y+ l, ]
write('</ilayer>')
) ^8 k, K1 ^1 t* [" l+ j}
2 D. O9 m6 {: Jdocument.write('</td></table>')
8 S1 L* J" B- e! W8 X1 k}2 ?6 T1 ?2 H6 ?- v
}
' @3 `' g0 ^1 i3 H4 W/ N' `</script>

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