返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& q2 V& {: [3 X% e. J! lvar marqueewidth=300
3 d: W; y9 v" o//高度5 h" {" T! I) H4 n5 Y) q
var marqueeheight=25+ ~5 u  x9 L8 c% \0 @
//速度(1-10)' S. L+ P" ]8 b
var marqueespeed=30 ^4 v9 K$ o. ^0 Q  @7 m, }
//背景颜色
1 O- c$ G1 Y% Bvar marqueebgcolor="#FFFFFF", p4 k6 V+ S( n
//是否能暂停 (0=no. 1=yes)?
  g. K1 V- ~; n$ v  M0 kvar pauseit=1$ e4 m5 V5 A+ |3 F+ ~$ L$ ~: K" p& A
; y) ~% s; f$ N# p! S/ Z0 _
//修改显示内容9 `8 R* p2 ?. f1 \8 q8 r
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 x) S, b4 W% ~0 G8 o
+ O& t+ v9 n/ p1 \7 A" D$ H- I( O

% x4 ~" U  f; W# U/ W* {////下面不需改变////////////
) d# s% W# @5 r  ?  v
5 S% ^) \0 U! s8 [var copyspeed=marqueespeed1 Q4 j5 W2 p, f+ Y, U8 r8 ^! l5 r8 U
var pausespeed=(pauseit==0)? copyspeed: 0
0 P$ |' s' t' e/ Y! z( E$ }var iedom=document.all||document.getElementById
9 j- A0 w) Y/ n% Iif (iedom)
# n+ _, h7 @8 ?& G- z. W- jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% K  Y! N$ H1 `5 c6 N3 q
var actualwidth=''4 V  G+ @, x& a( o1 W
var cross_marquee, ns_marquee
9 H3 p  O4 C3 H4 h4 L# p
5 s' Q" T* ~1 j: Ffunction populate(){2 e% r: f3 k# ?2 }. n
if (iedom){
+ P) \3 X' x" P! ~) M6 y0 ]# _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 N# F. s6 ~  q& A
cross_marquee.style.left=marqueewidth+8
, ]9 T3 N- {$ p$ u+ h  _, }cross_marquee.innerHTML=marqueecontent) L# z6 x* }& S% i/ X) K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 F) ^" b  f, l; q}% s5 U3 ]' \/ f) @" {9 s. H
else if (document.layers){
; }  r- R3 |( z) ^' {1 _2 P2 \ns_marquee=document.ns_marquee.document.ns_marquee29 X) [; V# C0 k" U- t
ns_marquee.left=marqueewidth+8
8 B, E4 g$ R$ s9 J' h' ?3 K8 ]' m. Pns_marquee.document.write(marqueecontent)# V3 w9 D; G3 H5 F8 _4 U
ns_marquee.document.close()6 T( p* H' Z/ x$ Q, \& v
actualwidth=ns_marquee.document.width
. H) m  f3 k8 u$ {9 G7 D}
) Z( `6 P2 Y. s' P4 b2 [$ E+ Tlefttime=setInterval("scrollmarquee()",20)
# ]9 U2 j2 L& }  V( s0 \! I' d}
& n4 I  c. W/ h5 Awindow.onload=populate1 r% R  f' @- R4 R

  I# z9 y* `6 w% @* ]* o7 yfunction scrollmarquee(){
$ I% X2 c6 T4 B6 E! Dif (iedom){( ]$ _* w" s/ {# F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 a7 u: E3 O) [0 \5 n9 Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, P8 K: C" s' ^* [else
& k$ P4 x; }) \# W/ Rcross_marquee.style.left=marqueewidth+8
. ?8 `8 W% N$ P7 D" p# Y' {8 V
  w9 @% X7 X" k8 x. y( \; }}' z) }' l5 Y  J3 f9 @. r8 a
else if (document.layers){
2 F1 q1 V, ?  T+ D3 z% ~+ N7 w: L" K, Eif (ns_marquee.left>(actualwidth*(-1)+8))8 W  L5 }6 z( {7 v) Z% G* h: F
ns_marquee.left-=copyspeed0 y; Y$ Q3 F/ T) r; F
else
6 N' r& B# e- f' ?1 fns_marquee.left=marqueewidth+8
. v9 \9 }( L; ^! _' d}
7 q, \$ K) L& m6 S; w5 T6 w}. ]: L+ X# ]% I4 I

9 X" [% S& c7 ]9 S( J9 X5 j- n, x( Fif (iedom||document.layers){( o, C- A1 m/ \0 K
with (document){& t3 A! p" n* {; A$ v0 N( a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); ^, }' Q. c7 Y! G: S
if (iedom){
' f* K" `; _' g, @. i9 _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 \1 m/ {/ a" k3 ~% |, S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 k0 P1 z* N: I/ P5 U, a
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 B$ Y+ O, u: ]; U! X" K) V
write('</div>')
/ Z$ d& _$ C  E}4 h& q) d4 l6 B
else if (document.layers){: M3 ]7 g% N. N9 S( P& C& ~4 ^4 y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) D( K- @: R2 f7 s  `8 Z8 Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( X& W; k2 j& Q2 S0 ~4 g) v
write('</ilayer>'); P# m4 g+ u, n1 R1 b' d5 `7 d
}/ F# e  @: i) w5 ?( q( U
document.write('</td></table>'); {1 a* |8 M" s$ N9 D
}
. l! s& @, B5 p; s}3 }3 Y3 A) p: x" G$ ?$ w
</script>

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