返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ M1 e# d1 ^. E  L' [
var marqueewidth=300
# O/ ~0 w; f, _. T* [0 i% _//高度, ]! D7 Z7 X5 k
var marqueeheight=25
4 z5 K! G$ z: J! W: Q//速度(1-10)1 K/ s1 Z: j% F7 j
var marqueespeed=3
  I: a- |6 H8 @" ]5 m//背景颜色
9 _" b+ v% v& m9 c+ Ovar marqueebgcolor="#FFFFFF"/ w: j" O9 T; F4 V6 ?  w3 \
//是否能暂停 (0=no. 1=yes)?( ^5 t, L" I8 C/ b! i  Z3 @8 s
var pauseit=1
) X6 D! Z6 L- h+ E: ~7 u1 g  Z
) n1 x$ e& n& j" O- x//修改显示内容
, E3 [6 _; k  z$ z5 E  D( @" E6 E3 Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; X% V. U4 P& a. k8 C1 P

$ a4 e/ X$ R6 [* A' o5 ]0 f9 O8 R1 B( L; m1 Y- C( f% W! ^
////下面不需改变////////////
' `- L! ~6 T% y* G8 T! u" H6 U9 [. Q0 n! q1 d0 U, L5 n7 a
var copyspeed=marqueespeed. V8 r7 G4 x* U4 o* Z% v: _7 f) X
var pausespeed=(pauseit==0)? copyspeed: 02 ?# A7 }9 ^! q. h: k" c
var iedom=document.all||document.getElementById4 a4 H; U$ Y6 c% o4 X
if (iedom)
& i5 _% F: z3 Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), V5 s' `  {' l& `
var actualwidth=''
- B# _9 q% z' u7 x: y: @6 gvar cross_marquee, ns_marquee
6 ~9 u! _2 h: W" O
1 H2 ~! D( w! |9 v% e* xfunction populate(){: n" ~$ p' i/ o: w3 C
if (iedom){
  o( @8 k  c8 d/ `$ ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" h: [$ e, O! L, |cross_marquee.style.left=marqueewidth+8( q) g; k' R7 F. c$ L4 e
cross_marquee.innerHTML=marqueecontent
6 }+ Q0 R- w) f8 b  m) F0 M. z& t1 ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; o! P$ ?& K' ]8 T' I' Z
}
8 ^* X- n( O# o, c" G% R3 |else if (document.layers){
/ {  H" v* A( L" l- j: c: ^ns_marquee=document.ns_marquee.document.ns_marquee2
4 t- ^/ V& a; u. H$ W+ @+ {/ N3 r* Uns_marquee.left=marqueewidth+8
  |3 W, u5 E  r* s5 a: h. uns_marquee.document.write(marqueecontent)
  X& f& l, e! B6 ^0 K/ \ns_marquee.document.close()
" N6 V& L* A& K0 {9 Nactualwidth=ns_marquee.document.width" Y' p3 U7 E; F1 Z# m5 S8 e, W7 Q
}
$ @( r2 K9 M$ G1 ~# d  S% c+ ylefttime=setInterval("scrollmarquee()",20)
  u; Z+ x5 H5 f, F7 N# f}
- p" q+ ~* |! n. }6 L. mwindow.onload=populate. A9 X6 W7 t: k* {

% j7 R* w' e) Jfunction scrollmarquee(){5 O( r* L1 X6 Y! Z
if (iedom){
& i. y6 j( D/ M3 l6 ^; O1 s: c) Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; E3 g  v3 B3 a/ o+ M2 gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* l/ ]; i, D# x6 B1 F) Q! pelse
) j& S+ X. _# O! b: v0 across_marquee.style.left=marqueewidth+8* I8 c' ?( N! Z& k, N# j3 K
8 l/ x+ M. V3 a9 B- p
}9 C& W6 F2 o. r3 [; j
else if (document.layers){6 e4 }2 k; R  W9 W& \% i; m' z
if (ns_marquee.left>(actualwidth*(-1)+8))$ I- R+ q$ a" o1 p7 U
ns_marquee.left-=copyspeed& B' `8 Q8 H0 O" j! f$ d& f
else$ \# r; L) z8 j' u* [  {
ns_marquee.left=marqueewidth+8
& ?0 u' i* }8 }/ _! H}
% X/ n5 z# j+ R# p$ L  O8 G}
% N9 X$ i* G- a2 q
, Y4 C% P3 T) f# dif (iedom||document.layers){7 n/ O/ ?" x" m
with (document){" c( R0 T4 S& j+ ~9 _4 b8 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 x( A( N9 k( Mif (iedom){
/ ^+ @: w) x. i% V6 X8 cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* P! d+ B6 H  ^5 [+ L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ n5 R6 T$ x5 Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; v# I* u- u$ o! wwrite('</div>')6 x! i8 \  g  R" N
}
/ n% a6 [1 o/ H  J7 q0 ]! s  helse if (document.layers){, j& W2 W1 g! }5 i4 [' u7 M5 Z; ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 M+ N3 y# g1 Y/ v9 ]8 w5 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). {# K3 \0 O1 K: W7 o
write('</ilayer>')5 [7 a& |* `: |0 R! ?9 m
}0 l+ F3 I1 n2 [! k  J
document.write('</td></table>')( Z# p, y: ]- y: r1 G; }
}; m" P) l4 n: G1 F
}
, a  P9 _* M/ H. ~</script>

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