返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 x" c: z1 K; S
var marqueewidth=300
* c; D9 }/ B! P2 E//高度
+ `  U) h% p* A- C6 t5 G) e# ?var marqueeheight=25
% c9 M. @/ v; M( B3 |5 r//速度(1-10)9 V& X2 W& ^' y0 Q
var marqueespeed=3
7 L( |! \0 Y; h//背景颜色6 M0 {! t3 x4 }  z
var marqueebgcolor="#FFFFFF"  K+ K# N2 B2 F' T
//是否能暂停 (0=no. 1=yes)?0 m7 t+ Q% L0 ?) z  a2 V
var pauseit=1
( z# ]* Z+ t& P1 m% V9 y' K
4 ~5 z8 v  d5 m/ d//修改显示内容( e, k, W# Q8 A, y% |6 t% x/ C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 m: D5 x$ w, K, D* M+ ?% i* s% k. G% p1 [+ X
3 j* m! K7 o3 n! H) o
////下面不需改变////////////, W- r9 i3 Z* B* J/ a! K0 _. s; E% H
7 J; U* {4 u; D4 o1 D; z( p% f
var copyspeed=marqueespeed
3 c! @( k8 O! ~1 p1 O- S' l0 |4 _var pausespeed=(pauseit==0)? copyspeed: 00 a( X% |9 B$ G# l! s# B. f, N. X
var iedom=document.all||document.getElementById
$ X& v6 J* ?2 s3 {if (iedom), j# [- W2 D0 O) d4 H% r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 T! I# G! @7 hvar actualwidth=''
" j8 C9 z9 |4 V1 I1 r$ Ivar cross_marquee, ns_marquee* M0 W8 C) E0 M+ o. K
$ }. S6 C2 f/ M4 z5 y
function populate(){
- W, e5 E  Z! d2 v. \if (iedom){3 ^! z! h5 y1 L& l: x' G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% F5 M- z* g' M' {8 F2 b
cross_marquee.style.left=marqueewidth+8
5 v' H  Z+ r, R' Rcross_marquee.innerHTML=marqueecontent7 O- P7 p) b3 \; @) Z6 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 _# Z' F4 X& h$ k' S7 i
}
, |6 i$ H- f9 \9 Uelse if (document.layers){
5 Z! ]/ z' z# c$ S9 s: R: X2 r( G5 tns_marquee=document.ns_marquee.document.ns_marquee2( j- U% n. u( m" g2 V
ns_marquee.left=marqueewidth+85 z' _6 ?% Z# w! m9 \
ns_marquee.document.write(marqueecontent)
+ N7 y2 M7 M* l8 B4 I- `ns_marquee.document.close()' j) n. F) |3 O9 x2 z! I5 \9 z- j+ }
actualwidth=ns_marquee.document.width
9 O+ S; h2 N. l% S! ]' M; B" P}
8 Y; I. ^9 p9 E0 _lefttime=setInterval("scrollmarquee()",20)
+ h2 ~7 _; l: W8 B}# _+ [8 c, K0 U3 s8 T; L8 Z
window.onload=populate# T: _* F; I$ x1 L) a: l

& e$ n3 p) V& H9 X; i" U9 yfunction scrollmarquee(){
( M) f$ H* I; R& c3 {if (iedom){
8 r4 Z/ E/ f4 c( H" j/ aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 i4 ?* d. A6 y, w) z7 z) Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 ?) `- B. e! n) }( h7 Delse
& ^% P) I- O+ A5 o* \9 l4 @cross_marquee.style.left=marqueewidth+8
6 O, x+ D' B# ?4 g( ?4 c: _9 d& z
- M0 _8 @" U% A9 W+ b& Q' R% e}
* v, r5 m7 q+ Y4 u$ x- n* uelse if (document.layers){
; K$ A7 a. ~6 L3 Yif (ns_marquee.left>(actualwidth*(-1)+8))
/ A' E$ a) I% y( |$ L# rns_marquee.left-=copyspeed4 z( J: V" M! _/ v
else+ @% t+ V6 S2 s$ _; J
ns_marquee.left=marqueewidth+8* o8 j& O% u+ F* e2 `+ t8 i7 q
}( a# x: V0 R2 g1 e$ X
}7 c1 g% W) N1 G

: L  t0 z8 h+ ?4 Q" z) ^1 Mif (iedom||document.layers){
6 L  y7 S% v7 ~& _. ]* {0 \with (document){
( m7 ^  V0 F8 O) ]4 @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 K1 o+ r8 B3 H0 I, L
if (iedom){' T! X; D# k% v+ j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 X& y* e) r: m* A5 C1 e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ |7 @( p- ?8 F8 i" a
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* k0 W4 [! f3 c" F; K# F# ^: ~
write('</div>')
- M0 p9 R, C& _8 H}% n2 M; F" l; V/ v+ P5 M
else if (document.layers){
9 o+ I- C0 L/ @! iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), ?# P0 H! @% j! [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 U3 X1 {- o3 k* h- X! g6 `, i
write('</ilayer>')
) E* y, K3 M0 |4 X* \}! B: l; c7 J, |. w+ v0 A' t
document.write('</td></table>'), \; x; d) a% Z* d/ F: K
}
4 a" U5 n! {' L, H}
+ N( M& y7 i' G1 M9 a7 _. U# l</script>

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