返回列表 发帖

网页之跑马灯文字特效

//修改宽度" x' k' g; i, `9 x# U& a( {7 [
var marqueewidth=300
: W5 \7 R0 \  O& y. F+ C//高度
5 W; A; I6 d" H% J& p7 Wvar marqueeheight=25
2 L+ d1 f6 k# U//速度(1-10)5 a' ^: P' _  B- j: V% K1 M
var marqueespeed=34 n2 w) h$ i1 [' s& q% ]' F
//背景颜色: f, B6 `: i% N5 A3 u
var marqueebgcolor="#FFFFFF"
1 r: S1 w& x. F. h1 S  ?//是否能暂停 (0=no. 1=yes)?9 x7 ^% G7 y5 B4 f
var pauseit=1  T# x9 R% h& ^$ \) _/ @5 p: S

& R7 H3 B+ _) a4 R* {! J' r! \% b. p//修改显示内容
! {) C8 {+ w; y9 n* Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& e; m1 D" U8 R4 A. {
4 C& l+ Q6 W; u3 I4 y& ~# |, C% P9 N( h
////下面不需改变////////////) M" Q# S/ O/ Q7 b  T
# U; Q& v/ L: ~* \/ H
var copyspeed=marqueespeed
* q9 H, B8 n' o' Bvar pausespeed=(pauseit==0)? copyspeed: 0  Q+ [. X$ Z$ p1 Y( z# m
var iedom=document.all||document.getElementById/ h, a0 w- C+ d/ t0 j$ `
if (iedom). ~: O( a. |3 O/ q  z* \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& m9 q# A  N% E3 Qvar actualwidth=''
% m4 G) l. \' R' Q8 m; ovar cross_marquee, ns_marquee4 t/ [- K$ S( V# T( t7 m
9 A9 P. e* P  }# x
function populate(){- N8 j  y$ D- N) H  u8 n4 d4 J
if (iedom){
* ?, v1 _: s; R" h  Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 u& X4 O' S) C+ N, w
cross_marquee.style.left=marqueewidth+8/ N& D+ b4 `! z# u! {
cross_marquee.innerHTML=marqueecontent
0 |' g* X) r$ }1 y' y% Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 T: ]% L% l; Y  X/ M8 `2 K, W
}
* }& L/ S3 g/ `else if (document.layers){
  z' X6 W; B7 V6 [ns_marquee=document.ns_marquee.document.ns_marquee24 t7 W' s0 D# s) ^
ns_marquee.left=marqueewidth+8. m' K! b) Q$ x( ~: w, E* n
ns_marquee.document.write(marqueecontent)
8 K+ m  V9 ~# Y& \, q+ Hns_marquee.document.close()+ Y( b2 ~! H4 G+ U8 {2 F1 t
actualwidth=ns_marquee.document.width
! u6 x, w. w! m( \0 {}
4 P/ U) g/ g' _3 \! E# w! Plefttime=setInterval("scrollmarquee()",20)
* E* z7 }% h0 n}0 p, W. ^4 V3 k1 a3 q/ ~& o, r
window.onload=populate
6 ]/ N# b  T; c& U/ H. R! w
0 g* X* G/ |8 [! N% J3 d! J* ffunction scrollmarquee(){% v7 X; u& T: O7 Z9 }9 ^2 }
if (iedom){
% z% M( _- _( ]# [, iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 c' n: d) u0 r7 f1 |& B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  q0 ]" u2 k! Z  T/ P  x" y) selse
1 q9 l% P. F; jcross_marquee.style.left=marqueewidth+8
# w: ~1 ]) f3 S8 l# b  O- \+ E- v3 Z% i4 u$ j  \! N/ q7 K7 o8 u' h
}  O5 E% S; m' ?; G9 Y8 Z% X: s+ i
else if (document.layers){6 D: K" T, i7 P
if (ns_marquee.left>(actualwidth*(-1)+8))/ D; Q% h2 s" r: H. a7 @
ns_marquee.left-=copyspeed1 g  Q+ M0 Y) |/ x4 g
else
  p; p' t! [" Ens_marquee.left=marqueewidth+8
0 B6 [0 G4 O" ~& Q. O' v: E0 `}, J/ z5 u; u5 [/ W; N  @
}* Z' ^' B+ F! n# j& I! f1 F- M

' P2 w7 c4 ^$ g- \* K# ~0 P3 |if (iedom||document.layers){  n% v3 i+ i, X$ D7 i
with (document){- m+ S% ^8 E& q+ @  x, `. m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); b7 H0 b& C5 ^# T2 a
if (iedom){8 t7 s1 v5 i. K$ u. x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  m: q" a: S+ c, p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): R0 V1 Q8 @$ \5 v2 o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, I+ u7 ], g  j) Y$ jwrite('</div>')" T8 G+ b# b! r
}& x2 L3 p- Q; D3 D
else if (document.layers){
& i- u: ?" Z7 S3 w0 r0 ~; {0 D4 c( }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ Z3 y2 c* q$ a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ g2 O3 v) B7 y8 X; m0 P& }7 y
write('</ilayer>')
& m9 r, w& S6 s9 B}
+ z6 [% G3 e9 k, [- m' W( C' F- `document.write('</td></table>')
4 X" `$ s9 T2 ?: L}
/ w* ]8 U) ~- n& X7 _( l}% J2 G% _$ a( U/ k7 h! q- x% A" }& D
</script>

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