返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! f1 \! b! r$ ovar marqueewidth=3003 X' P+ |0 L' |! Z% m' w8 g0 l
//高度
. x: ~& X0 G) y" y! @var marqueeheight=252 F; \' T1 r) A' `! K# I+ o
//速度(1-10)* V  X. x$ m% e
var marqueespeed=3; e9 A; t- H' k5 N, m4 H
//背景颜色
; g- a! c! Y+ D6 A1 s8 J3 G% V; Cvar marqueebgcolor="#FFFFFF"; S% x7 ?5 g8 ]  o" g; |$ @
//是否能暂停 (0=no. 1=yes)?
; ~& w: y, S/ e- Qvar pauseit=1
6 {& J* m2 K+ I' z7 R0 Q, ?8 k. ^# E" z1 Z9 y% k
//修改显示内容2 S' I+ V4 I. L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! G$ i. d. ?0 O1 I

+ ^' U" s# y, s& y" N
# J7 _7 p' b7 v/ K! T////下面不需改变////////////
- w9 j( Z7 P4 m6 r! F3 R1 \
* w! U2 Y. Z* {: Wvar copyspeed=marqueespeed3 L" {/ h) I4 I0 ^- i* u
var pausespeed=(pauseit==0)? copyspeed: 04 v. t2 O2 ]2 k8 H5 v# ?
var iedom=document.all||document.getElementById
% |) x" z7 F8 g$ \" M% t: wif (iedom)
2 Q2 ?7 k3 J$ V% idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): u+ d6 A' {- l$ j
var actualwidth=''
0 l8 |' L% Q  P5 l- O/ jvar cross_marquee, ns_marquee! r* g* g2 _' D8 j
5 b! H9 l# k& S- I$ C) w
function populate(){
7 l  _- U7 U! Uif (iedom){9 C6 V9 c/ X7 ?5 L% `7 A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ j* l1 @# E- v  {- j
cross_marquee.style.left=marqueewidth+8
/ M; e1 \- [4 T. y! h- `6 N# ?( Qcross_marquee.innerHTML=marqueecontent. f' ~* O7 l8 l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, ]( r, A: O1 e}
% c4 c2 ]: K0 {else if (document.layers){
* v# J4 d- d2 W& ]' |) s4 zns_marquee=document.ns_marquee.document.ns_marquee2
/ s. N/ x% p" j( Mns_marquee.left=marqueewidth+8* V  T- b' A2 J2 E5 F
ns_marquee.document.write(marqueecontent)
9 D- k* r) {7 Zns_marquee.document.close()+ I9 y% f* @1 @. p$ l0 N; |; @6 b
actualwidth=ns_marquee.document.width
+ z2 z3 O( V- ]& w8 M}
/ p- L2 o  D0 r8 p: a$ Ilefttime=setInterval("scrollmarquee()",20)  [3 x; H3 C4 q7 K7 H$ O
}
" g4 c4 k  U9 Q( `' e8 Zwindow.onload=populate
; S' g* h& \7 B8 L0 q) Q) V; P  T
function scrollmarquee(){" c1 L7 S+ Y2 o$ ?1 z
if (iedom){2 O" c* ~$ d$ i( d2 p, o& B) L( Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 d  A7 o% B  H/ }
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) Y; B, B8 d6 U$ Y, D+ L; J5 O5 P
else
( g( ?) G/ s% J. ~4 r. y; rcross_marquee.style.left=marqueewidth+8
$ V& o* ~0 ]) I9 c* m6 i& r* ~4 r/ Q! a6 m( |' r, ]5 U3 s
}
6 [  Z: x4 h( J+ q/ v; P, u% Qelse if (document.layers){2 ]3 h! H% s, X9 {0 L' A3 g3 r1 K
if (ns_marquee.left>(actualwidth*(-1)+8))
+ ]0 c$ Z+ l( E  ?! x' K* S* wns_marquee.left-=copyspeed
& Q: M  X' A* O6 k3 f$ W, delse5 B: L: Q( i% z
ns_marquee.left=marqueewidth+8
$ ?8 H! |3 i2 J6 h  y}
, N4 o/ R6 Y4 T' @& Y}9 }  e- M2 f& W# ]4 C: m
; G4 K* r5 ]0 @" g/ {9 A& C! k# _
if (iedom||document.layers){& C' P+ P, E: n1 D
with (document){
0 ~, `1 z1 S# i+ {7 Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: y# K& f7 b( sif (iedom){3 Z+ D8 j' c1 w2 K6 w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 D' ?/ q! H: G. O; qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 r2 P7 E  X9 B8 m2 e3 C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, |1 g- p* G4 u& n/ M& ?# q: z. s5 iwrite('</div>')( o0 `* P% I. B9 s; q* o
}
+ {, `4 \1 |0 telse if (document.layers){# N" C1 Z% J/ x: d8 ?) a3 H6 s5 F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 e3 }6 Q& k6 a2 k1 ]4 twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) W8 t2 R2 y' v0 H" w
write('</ilayer>')
8 u2 s0 C" q) n6 P8 ^( R}
; ^; c( [' N0 E: V/ K' T/ [& I" ?9 rdocument.write('</td></table>')0 V3 x% s- F$ r% S- Z9 x) K
}6 d1 [+ r4 u0 t) S" o2 G
}
1 K  ?; E  c% E; j0 ?( J% P</script>

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