返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. _1 V- }1 Y' s, a# X+ @& u, T" Evar marqueewidth=3001 x9 Y9 ?+ N0 I0 v
//高度
0 ~* P. p1 l  I1 Hvar marqueeheight=25
- G# `& w3 @% F4 P% L//速度(1-10)
" Q8 m/ D5 H# E5 g- ^' gvar marqueespeed=3
  F6 L- s5 f# _% x//背景颜色6 }8 J1 M. w7 v: K  x% L2 s' j
var marqueebgcolor="#FFFFFF"5 D) e3 M9 o# a
//是否能暂停 (0=no. 1=yes)?! Z" G. I  ]1 I1 a$ }* P
var pauseit=1
/ D7 g5 n- X2 {/ b' g: H  {% F5 ?& q1 j6 N+ I* E! d
//修改显示内容: N9 c8 z0 {. \  L; x  Z/ n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ y* p6 [3 J1 I' o5 g0 V, n" ~$ `5 \$ O, k+ ]

/ i! p& n/ {$ T0 Z! Q( g////下面不需改变////////////" {: E0 I' [2 f8 @2 X2 g; \
5 h, a! {9 @: p1 k" {3 j1 |
var copyspeed=marqueespeed
& ~  K" }, P& Z4 P( uvar pausespeed=(pauseit==0)? copyspeed: 0. k1 r  q3 _0 s7 z5 r
var iedom=document.all||document.getElementById
+ R# q3 q  Y% |0 O8 gif (iedom)$ P) k. {( ~" J$ w& l$ U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  O& F9 o0 `5 n( j7 M; @# U6 Vvar actualwidth=''
, q: u; Q3 @5 x5 x3 E& V& Pvar cross_marquee, ns_marquee1 k7 L* l2 `5 [' p( V
5 a3 l5 ?- S3 X% k( U) p. k
function populate(){
8 m' r) n* b6 E9 B1 Nif (iedom){
4 z0 }0 k* D1 C' }' ^( j; xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- V* k# }; x2 S; H& P4 }5 Z( [, H4 G
cross_marquee.style.left=marqueewidth+8' s! c3 p; E1 ~5 {6 G7 W
cross_marquee.innerHTML=marqueecontent
* V8 x( c# i  i9 X" cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& ^# x: r3 `% ?& e# e9 i0 ~& I. H}
" l  U3 H0 O& q6 A. [2 _) E" Z5 n: Nelse if (document.layers){% ^$ [6 S' E; m
ns_marquee=document.ns_marquee.document.ns_marquee2, h+ e, Y. b/ t  l
ns_marquee.left=marqueewidth+8
) S+ C0 Y1 r; B* V* ?0 s# vns_marquee.document.write(marqueecontent)
; j! C6 v$ T( X8 Xns_marquee.document.close()7 J8 N" D. `1 p) d% x9 ^$ w: r
actualwidth=ns_marquee.document.width
" q7 N, @+ W7 }6 J  W) G* q}- Z: O% \9 ?+ q
lefttime=setInterval("scrollmarquee()",20)% m# [7 `: m! h; ], \
}- Z5 O, C1 x( z" J9 A6 r$ u  o
window.onload=populate5 S4 y% }. n) u0 \' ^, [9 t3 w4 Y
3 A: b! V% _" {0 I# ]/ ?& f) t
function scrollmarquee(){
7 ?- k4 ~, d+ ?) pif (iedom){( h% x1 m8 n7 r! H3 I% u4 c
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  y) [+ @# W9 U* Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: O: m3 x/ W6 ^, l& N4 a! X
else5 I: h0 M1 I* R2 k! u4 w: V5 y8 B6 A
cross_marquee.style.left=marqueewidth+8
7 X$ a5 i! d+ J: [/ F) f$ V3 S% V' T; _7 n( p3 f0 I$ ^# S7 x( S5 P0 R
}9 t3 K: N9 F7 J2 S8 f, Q
else if (document.layers){# U6 @* f4 g' M4 a. A& r
if (ns_marquee.left>(actualwidth*(-1)+8))
; S) s5 B/ R' @" q  Y  N' @ns_marquee.left-=copyspeed
# z6 q; n/ L4 N/ J* Gelse0 B2 n3 x: p. N' j4 t
ns_marquee.left=marqueewidth+89 d! ?" c3 S' F4 V2 `0 [
}
" o) d0 A+ r$ T& g, O}
# m8 @" n: Z) |* R
# @/ Y$ a% I5 K8 p0 w. Oif (iedom||document.layers){
8 s1 ]! ?( }8 i7 {  J+ Z+ pwith (document){2 y# a. e7 |  v: D# I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 ~) H* |' e& o! uif (iedom){. M9 t# Q9 r. a. E. p) [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% N; O" I& c. I4 j: R- c/ Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 ~# ]7 f- [3 T7 w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' P# S. }( J  E2 c6 g$ awrite('</div>')
9 [" X% `8 S8 w  N8 n! D' I}
8 j0 R* f& i) Oelse if (document.layers){
) p3 f* ~+ ~3 ]' Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 H/ Z6 z  M& N- l# Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" V' J& j- p$ a: r3 c" d6 Jwrite('</ilayer>')+ w4 ^6 R0 W2 ?6 ?0 K4 q
}
5 J( E  C6 _) g2 p  [document.write('</td></table>')
3 }7 V, i4 I% V- t6 n4 ~}% V5 x/ }" k: Q( U% j4 r( V8 G: y
}
0 Z5 ?7 Z. u7 F8 [  _6 K  J7 ^5 i</script>

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