返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ f- Q" Z2 W4 |7 L. }  C
var marqueewidth=3008 F; o3 ^$ E' L; U) l# I
//高度
' n, W: D, M* P+ M8 cvar marqueeheight=25
- Q1 q5 P1 e" c# q, u: L9 V( X//速度(1-10)
% c; Z% w) Q. H- U! O% e- z- u% vvar marqueespeed=3' h- X8 S& j. p/ k
//背景颜色  W3 q4 }; ?, ?- Z8 r
var marqueebgcolor="#FFFFFF"
3 V/ Z4 @' @. N% j//是否能暂停 (0=no. 1=yes)?
# T! F& O0 V* Q9 s$ B) j* Ivar pauseit=1. D* x6 p' |6 B* Z) M

. V3 N7 N, c( F- `0 x1 o! }//修改显示内容$ n) O( B2 L! R9 V! r( D0 d! m9 ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 N5 G+ b8 J7 d5 q* z5 @

6 s' g  j+ k5 n* S5 ~
# I1 O' [% Q" N7 ^! r2 D////下面不需改变////////////
0 }3 a8 f5 W2 G4 U  P- n$ O- ]' Z3 \# U
var copyspeed=marqueespeed) {& z. n; p; g
var pausespeed=(pauseit==0)? copyspeed: 0& F3 U& g7 X/ s1 X& q" F0 ~6 x
var iedom=document.all||document.getElementById
  v3 O" f8 t6 a0 t& I9 rif (iedom)
3 n8 E& g8 e& \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% D/ P5 ^7 s5 [4 o  M# f4 L( H
var actualwidth='') J( E* s2 ]9 p
var cross_marquee, ns_marquee
! m" O: V. N+ g  n1 R0 b! u! [6 J9 {
function populate(){
9 H+ g! y, @! G8 Q: r. k% rif (iedom){$ w: O! |- u* G. _+ t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ J. L. e2 Z) m: ~5 Y; ~/ Z
cross_marquee.style.left=marqueewidth+8
$ j; f' B! s$ f5 f2 |; ucross_marquee.innerHTML=marqueecontent+ J; O/ T' z6 f- ^" b- M4 v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 E! p* b4 y5 c) ]* K) z
}
& \" w& X6 O' R" k" W8 Delse if (document.layers){
- ]) Y2 H* h" d: c! O% `9 yns_marquee=document.ns_marquee.document.ns_marquee2, U* n+ z! t' u5 ]
ns_marquee.left=marqueewidth+8
, K& b' e* }! |; j5 k6 xns_marquee.document.write(marqueecontent)9 F& \" N: S" m  F) D
ns_marquee.document.close()
+ M: F: |7 c# m- E/ n) `) Y- hactualwidth=ns_marquee.document.width+ ?5 d* W% X( Y) B. g0 ^
}
# u3 T9 Q7 b0 \" Hlefttime=setInterval("scrollmarquee()",20)
/ k0 ~2 @. F9 T9 Y}; z" l! J% T  t: w5 K4 [; u" N+ d
window.onload=populate
! S3 K: ^% @; s0 R( x7 {5 h( `1 u3 N6 W9 c5 w7 y, Q
function scrollmarquee(){8 `/ d3 ~3 n. f4 o
if (iedom){
( ?: z0 t7 |, `; E! y  C( dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; H# z! m% _, n1 S- _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! s) [  c) C; }3 kelse
/ I; [# x6 q$ n5 E& kcross_marquee.style.left=marqueewidth+8
/ @& i: C" U$ d7 y& q; d/ n% o
" G$ e+ g8 v, u9 {( ?/ q5 W}
) I0 P$ w5 e; b' _( [else if (document.layers){- I1 n! W- o" E* O! f9 U9 w
if (ns_marquee.left>(actualwidth*(-1)+8))
0 w& e/ g3 E+ _0 E9 w, Q% h4 A; mns_marquee.left-=copyspeed" @" f7 v8 Z" c0 F! h
else+ f$ X5 d6 P+ b' F* p7 [
ns_marquee.left=marqueewidth+8
- b3 X& y, D8 {# z2 G}
. B' `/ j3 K& r7 b/ d}2 E0 r, z" Y3 K8 \4 V6 ~! x6 ^& x* T" o

; d1 m4 \' i4 R% }, Yif (iedom||document.layers){
4 [' D( d4 @2 F. ywith (document){
1 K' G2 s7 _5 l. n8 |& b5 qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% [! x8 m" @+ \if (iedom){
, R- E5 v& k# e& {0 m% E  X. @3 }% Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), {6 E3 t5 z* s9 V' O8 l4 R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ X: e5 N9 Y! fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 {# s3 q1 p: D: {1 B8 J6 o8 E' ewrite('</div>')5 m8 f1 N% M: y6 T2 D$ V+ W2 z
}1 T7 X" X" M6 e
else if (document.layers){( t" s! Z. H: ~) \3 O. s4 W* |% U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- \( P% H  g( A0 R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ T5 q! O% ^* @8 E" G/ A
write('</ilayer>')
3 T! j% _+ n' R5 k3 ^8 q}
( x/ W& N/ g# t& q" U& @' |; Z# Vdocument.write('</td></table>')
* Y8 R* W. D, I# G- r( H}/ |" w$ W  b  a7 m
}/ w! e. ^( G/ j& f
</script>

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