返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' d8 H5 @# D; R5 |0 T8 [% y) [var marqueewidth=300) |, R/ D0 X6 ]
//高度1 ?+ f0 k  X9 z" B' p6 h# s7 D
var marqueeheight=25  @* ]( B, C8 w) j( u$ x
//速度(1-10)
3 ^" n0 h0 ?3 [$ {+ n8 E. uvar marqueespeed=3
/ N) i6 @1 J. W! W0 |, @//背景颜色" Q0 u2 y0 s5 ~4 ?! V' I3 h
var marqueebgcolor="#FFFFFF"" e; v1 d* h% E. ~1 T: W& l4 w
//是否能暂停 (0=no. 1=yes)?" o' a( n( U4 O8 L2 m/ v( j$ x( I1 m' Y
var pauseit=1
4 V+ C+ a6 d' R# @( V
  C1 n  D5 f- u0 J6 S7 N//修改显示内容
5 M( A! m+ ~: I* Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 s) ~' h+ n1 u- U6 p# L7 @- M0 }# ^. x5 m$ {
; ]/ M" @# n* _
////下面不需改变////////////& o: e2 M. k. C: A2 w; Q! @' B0 G
6 J! ~9 O2 C) J6 X
var copyspeed=marqueespeed& I2 v1 q# q8 O% G& h5 I5 w( @- d
var pausespeed=(pauseit==0)? copyspeed: 0  Q3 Z, _1 z& `: Y" H& o
var iedom=document.all||document.getElementById. {' V/ c' t7 G( g" |( [- C: ^
if (iedom)
+ Y" j; l5 u: L6 s  l! S/ p; g: Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 t; W" p8 l5 j6 H* A  [
var actualwidth=''
7 q5 t; p7 U$ n+ W4 }var cross_marquee, ns_marquee
. |: `; n+ ~' \. ]7 k3 ]  }. ^8 D8 S  u. D
function populate(){
# w/ k  h0 ^0 nif (iedom){
# a) t3 x8 H) v/ b4 a6 tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 S3 t% D* B) y) l2 u* ]2 D
cross_marquee.style.left=marqueewidth+8* t, E9 D2 q1 E5 x
cross_marquee.innerHTML=marqueecontent
4 j7 X, F+ q$ c$ Z1 y; }4 Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 z7 O: |% S- R7 R1 s! ^; M}
/ Z* p2 Q4 m1 b5 pelse if (document.layers){4 x8 @1 x: v: G) T: k6 h
ns_marquee=document.ns_marquee.document.ns_marquee2
& y5 s2 }3 V8 b# ?/ Y. Dns_marquee.left=marqueewidth+8! i! D/ ]; R- |" \) k3 q
ns_marquee.document.write(marqueecontent)
  J, \  D, Q, O, n% Yns_marquee.document.close()
1 ?3 M  p3 R+ Q) ?actualwidth=ns_marquee.document.width
5 {6 N# W4 f$ h7 z! K}* p5 G# j7 X1 C# X0 S1 s
lefttime=setInterval("scrollmarquee()",20)1 \( L4 k& f$ o+ n! h
}5 b" e: N9 E5 b1 b- ?! m# i. g) R
window.onload=populate
) g8 z# L; i. [4 c8 o1 k' y" ], h$ c
function scrollmarquee(){1 `. Z: I& D2 H8 h
if (iedom){5 Z+ M, F: ^7 P8 W  y' J# g2 i" W, [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% _% ]. Z+ I1 h$ |$ j' y- Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" o4 i# E3 a+ k' s% Z; ]
else/ u* F/ I$ f5 A- e4 B
cross_marquee.style.left=marqueewidth+85 U8 T! f: ~) m7 o3 u- N+ k

( o8 F5 t( R7 a. W4 s- V}
8 C& n2 X5 N- c! ]8 j7 A: P8 |else if (document.layers){$ F: ~3 \$ `) o% {
if (ns_marquee.left>(actualwidth*(-1)+8))* I. B! i% T6 B0 A
ns_marquee.left-=copyspeed
0 G8 y/ V4 ?7 Oelse
8 g; p$ K* d6 g9 \1 _0 Gns_marquee.left=marqueewidth+8
5 I. S7 s4 E' U5 ^) T}2 w8 q8 J" j  n$ h  A
}1 g1 V1 h: P& j, j$ A& G& o3 J
( H& O# A+ o, P: f1 C4 w4 ^; T
if (iedom||document.layers){
+ x8 U- L6 m/ E9 z6 ?# i0 iwith (document){8 f$ a; I! x* x" ]) ~+ s' B- K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 r6 S( R; N" M. Q6 ?
if (iedom){
# C* A# a8 Y; a. t8 L9 l8 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  U$ `" A7 O3 v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 {8 p* {3 {  |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), N- w/ ?* b# X& a1 ~
write('</div>')# l2 }- M) n7 F! C
}8 f% a$ B3 M# e# d0 y+ e" k
else if (document.layers){
# l3 m) j# O- twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' F! R; i) n$ s  _0 Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( o+ ?9 R2 M# i) W% R" R) R. L
write('</ilayer>')- r6 w; g3 w' i6 A
}
: v( H" c7 v( H* ddocument.write('</td></table>')
% k& P5 ?$ `( H& Q9 @! D% q}3 s; O. N' ^7 _# `' m* S7 [; {; s1 C+ d
}
- R$ X$ c. Y2 y* Q8 ]9 }</script>

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