返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 Y+ b0 Q: K- O3 p& s# wvar marqueewidth=3006 A4 ~7 N+ v  d  v6 n9 B- t7 a
//高度
$ u! ^  Y# [" p# [& I  G( q. X' hvar marqueeheight=25
3 S& N3 r4 t# ]! E( ^) E//速度(1-10)
% X9 B0 W4 _. \var marqueespeed=3
' s& x; b# X# a7 j//背景颜色
( o2 `; t* k' Y! f/ P2 ]$ X- Xvar marqueebgcolor="#FFFFFF"
0 @6 L" g. R: B+ i( s6 v//是否能暂停 (0=no. 1=yes)?# O3 x, S1 p0 d5 w$ S( P& b
var pauseit=1
5 ]" z" y! F0 X) y! z' B+ t* q3 p* a  d: M6 A- F
//修改显示内容9 u& f2 R- a1 N. [5 `$ Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 L) p0 X3 R( w: N. O" r1 n
" o8 u, T" c7 \% B! [

6 w7 |6 f) b# o4 t, {' [$ J+ {! k3 T////下面不需改变////////////
5 P* g; e# z9 x0 X' c4 V5 N9 t3 l& e6 I! u
var copyspeed=marqueespeed. K3 r! Z9 J4 |  S+ g! x7 b% G
var pausespeed=(pauseit==0)? copyspeed: 0  X8 y* L, p! G- M2 c3 o
var iedom=document.all||document.getElementById
- w3 }: l5 b  H2 _6 e9 Rif (iedom)
  `! j$ D+ x+ _2 ~' D& e' ^0 S9 mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& o4 u, }3 l  @; L, c; {3 cvar actualwidth=''7 a( I! Z: ~: g
var cross_marquee, ns_marquee7 U" A  \" f! X+ O: d8 F! U9 E

% h0 l* }: `3 i( A2 K/ x) Rfunction populate(){
4 \' Z+ G0 v9 bif (iedom){$ e: R' X2 u. f; W) o% a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) C/ w) |3 T8 {6 T) m2 K& ocross_marquee.style.left=marqueewidth+84 f  c# N+ |$ Q) c. r5 c
cross_marquee.innerHTML=marqueecontent/ E2 k& o4 N2 i/ [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- \" l, `: X8 [}
) ^* q5 V9 T' I! yelse if (document.layers){
0 D  A( q2 K9 P/ Bns_marquee=document.ns_marquee.document.ns_marquee2# D5 B4 G' \- F4 h1 c. s
ns_marquee.left=marqueewidth+8* v- V3 x$ r  A1 X
ns_marquee.document.write(marqueecontent)
3 Z8 ^- z! K) h+ z6 {& G& Mns_marquee.document.close()
3 ^0 }& X5 ~  m- cactualwidth=ns_marquee.document.width: I7 \, D: F4 z
}
9 J/ z$ G3 c$ v0 Q8 W# tlefttime=setInterval("scrollmarquee()",20)
/ S1 z- i' B# ^4 d3 I/ T$ c4 Q3 m}
: r' q* K* a. L; Y- nwindow.onload=populate
  j$ H  O1 V. A1 P$ O" L' v* Y
. o3 o: s# R) vfunction scrollmarquee(){
  o7 ~$ Y$ ^0 }% X; @if (iedom){
' F' v* {# \$ b$ ^8 N8 @  m5 [1 Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ Y2 Z/ ], Z( ?- D1 J9 T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 S9 Y% _/ N/ h1 ^9 O) E0 b$ {
else( M( m5 `% O, U5 H* ~/ G
cross_marquee.style.left=marqueewidth+8! g, L7 c1 I. m& `( t+ q

+ n8 B% t2 s- M1 ]0 y: e}
2 C  E# i0 R5 L! g! H8 Selse if (document.layers){
7 O1 U. v0 k, h- \: m" G0 ^if (ns_marquee.left>(actualwidth*(-1)+8))" M8 q% _9 a6 j; ?! X0 G
ns_marquee.left-=copyspeed
" x- S3 H( V' ~$ G- v! Lelse
+ T1 D$ A4 S' o2 ^! l7 tns_marquee.left=marqueewidth+8. _8 A3 o/ b2 `/ Z
}3 X( E" S1 q" a/ p& @" {
}
* f* Z$ k: i" s) i8 ?. r  y; x' m5 z" Y+ U8 _6 V& e$ o& \
if (iedom||document.layers){  z& w2 B( u+ V3 y( C0 G# n
with (document){
) K. R2 i8 f. o7 @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ ?8 A; V$ h) O. x. Y3 E( a0 _if (iedom){
" h* E! h; g6 x5 j4 O7 _, H% Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. L3 F2 _' y4 [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 ?! V3 g' f& K9 g* W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 n4 q4 n) z6 ~1 p; B9 ^
write('</div>')
! x2 U7 Z, I* Y- n}( Z4 B  d$ n$ \
else if (document.layers){
! u2 c/ ~" y  p/ ?& K$ m" W9 |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 V, |6 l2 j6 H( N, U8 w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 U, l' o' q1 o! @
write('</ilayer>')% J: O2 b1 Q4 p
}5 c, y- [9 u  s) @9 y& l
document.write('</td></table>')" s1 X, w( d8 r
}/ `! y" U2 A, D" F
}
6 b/ U) ?% x! E6 K- d</script>

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