返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 J: i# _1 A5 ]( K) [
var marqueewidth=300" b& Y$ Y# Q" u% Z+ X% ^
//高度
: Q- L& e, ?  }var marqueeheight=25
" Y6 m+ L8 _' D1 T//速度(1-10)
" R/ b. X# W* K" gvar marqueespeed=3) w; D& x$ v  d9 j* b# H
//背景颜色
; B( l8 i6 k! z& W1 u: z. h) Wvar marqueebgcolor="#FFFFFF"
$ a$ C+ G1 c& ?; n( H9 F//是否能暂停 (0=no. 1=yes)?& V; g0 i0 M5 J6 @! |
var pauseit=1
0 A% V% c( L  W7 f8 k: e! P+ t4 ]& q
//修改显示内容; @7 A2 o  K- x) {6 \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) T) N  k/ w+ `/ f' C2 Y; l6 v1 Z; ]  ?' j3 ~

- Y3 w  a4 s+ _; `" |- N4 U) [////下面不需改变////////////
7 K1 P: |2 t( \: N6 `1 o  ^' x  A& d; s* z# M9 V- Y! [
var copyspeed=marqueespeed' X4 a) l* a, C$ X$ O2 t* N
var pausespeed=(pauseit==0)? copyspeed: 0
9 T. `' D; f: C! Jvar iedom=document.all||document.getElementById* b9 t& b; W' e9 U+ ^
if (iedom)
3 m0 m0 J- |! H* Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% }/ P/ y3 z& Y& [5 W9 G
var actualwidth=''- Y9 P$ F6 H9 h5 m! X( f* [
var cross_marquee, ns_marquee0 t% F# s  g" O: v; w$ X
" n% V/ l" c( z# j. q+ f
function populate(){" }6 H7 V) O9 P4 r$ B+ |# d! I" E
if (iedom){, [/ s. w5 M" r# O* j. h- I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# X, n) O- G# Q' a! d
cross_marquee.style.left=marqueewidth+86 b4 r& s" ~: v% T0 ?/ H# a6 o
cross_marquee.innerHTML=marqueecontent
9 T+ F% e2 E6 ]' l& r' |actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; O# J6 m' d: }}
) F1 `8 E7 t; Q* u& `else if (document.layers){8 t$ R+ `  x/ K$ L
ns_marquee=document.ns_marquee.document.ns_marquee27 o& ]; m. }% l4 _9 o& G+ Q5 I
ns_marquee.left=marqueewidth+8! a# i6 |& _1 Q) E- w& V9 m1 e) J6 _' g9 M
ns_marquee.document.write(marqueecontent)
- q. h: H# Z3 b) c% _% uns_marquee.document.close()4 p& b1 Z4 B' G' N0 \4 G5 ]/ I
actualwidth=ns_marquee.document.width
" g0 ~+ e6 o% @8 y- i! U6 Z9 ?2 n+ ?}
, u* i( T' L7 {3 Slefttime=setInterval("scrollmarquee()",20)
/ {5 s3 s$ p5 I9 G}9 n1 `' x' v+ F3 s/ ]! z2 C* A
window.onload=populate
1 P* O  ?6 l/ T" E
( n& f6 q3 D/ [6 u* s4 ]( ifunction scrollmarquee(){# s8 D4 |& h7 ^8 Q0 {4 K
if (iedom){
1 Y$ C- e- w' ~# Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 ?' j7 |4 U/ T1 H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) a- C) C: ]' A! P2 t) r' ielse/ r0 n+ a) A, o; K
cross_marquee.style.left=marqueewidth+8
) a5 O" I. \& }8 Z% z9 o+ f; Q. h
}; D( F- S) B5 z* [
else if (document.layers){
7 r( F4 Y6 N7 y  `0 I1 aif (ns_marquee.left>(actualwidth*(-1)+8))6 @6 D0 X7 W  P$ x" j: t- G% }
ns_marquee.left-=copyspeed$ N4 Y& H7 j  H8 S( j7 @- y
else
4 n5 w" z4 E6 r! F* E: }ns_marquee.left=marqueewidth+8) y9 V9 u8 M6 y5 n
}
$ u, H* X0 }- F}
, U8 \, q0 J4 G+ K* z% E: I/ q# `
0 Z- a/ V3 ~; R4 n4 |6 `: Pif (iedom||document.layers){; K1 b1 g, J- W4 A" \1 E3 s4 v
with (document){
& }0 j& K$ M/ \3 g) A' jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 w5 U* L. x$ G0 V# I3 k; l! n) Wif (iedom){
" l1 u" `& I2 e% i9 R. u! Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 K, d; t: F1 u' E/ r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); k& O8 M" R1 Q: q/ E7 q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( L- ~( \5 N; Z$ ~  qwrite('</div>')$ Y5 n8 g; b9 K( O; m
}
2 b4 I; B, R" m: \/ F+ M3 nelse if (document.layers){
1 W3 |  x8 R( C" D. ^7 vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 F0 [& P3 ^2 [& |7 Z' e7 \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' M+ k9 Y2 z( z* _3 a
write('</ilayer>')
+ E0 j3 [1 ?! n}0 V# r" m4 F; C) n- P- A1 g
document.write('</td></table>')- f' W5 |, R; s$ a7 x
}
" p- S% T: o* O; {7 _' k: S% O}
4 Q3 t  [1 {. m</script>

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