返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 P$ W: Q+ y, f; ^5 n: ^
var marqueewidth=300" N# r. d% n/ k7 m
//高度# d7 h; T% L3 L- W3 o5 s& n
var marqueeheight=25
* C0 v2 c6 s: [  _# u0 I//速度(1-10)4 p% `, F, W/ e# Q7 C3 ]
var marqueespeed=3
6 l9 W* }; H. M//背景颜色" ]/ L0 Y2 {/ [- r; W) m- W# ^2 G
var marqueebgcolor="#FFFFFF"! ?3 e( ?! R% U
//是否能暂停 (0=no. 1=yes)?0 O' K' H% r7 K, u0 N' `4 i9 |% Y
var pauseit=1
) \1 N. ~8 g1 w& K6 W% S
! G( b! I  ^9 g8 q, R6 _//修改显示内容
! Z( f& I3 M# W! Q1 X( Y- gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- n' r. |$ u( ~1 J" r& K7 ?! ]/ G, Q8 `' R, F
4 \5 N" L2 d# J8 v% V
////下面不需改变////////////: A6 Y" ~( s6 S

* W7 I; G* t# xvar copyspeed=marqueespeed
, w7 F; Y2 E+ C0 Cvar pausespeed=(pauseit==0)? copyspeed: 0
% X; |$ X3 F" l& y+ Pvar iedom=document.all||document.getElementById
, ?# p& T% P- F. N( dif (iedom)4 l; [( b0 {: P# p2 g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  B# L8 t' n+ e( G+ h1 P
var actualwidth=''' J; Q6 }+ {: k
var cross_marquee, ns_marquee
1 s9 R: ]4 x1 A9 I
& ^( }- w9 E: L: r6 s4 Ffunction populate(){3 `% x0 g; h; i  l" V1 ~
if (iedom){1 w8 T9 {* J* @1 p
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 ]' k* E6 Q+ H% Z# T
cross_marquee.style.left=marqueewidth+8
+ K* y- I/ c1 r: K- x0 Ucross_marquee.innerHTML=marqueecontent
( Y% f8 I' V, W3 ^8 uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ D) t( i  ~+ r/ ?& ]2 J3 Y! a
}
' `: O1 u9 G9 c% T4 xelse if (document.layers){
& Q0 P2 K4 v- o* s" s* Uns_marquee=document.ns_marquee.document.ns_marquee2- P5 e# }2 f; R  F' A. d* r
ns_marquee.left=marqueewidth+8
% t- n/ F, u9 N  }0 Ens_marquee.document.write(marqueecontent)6 D) K  B. E5 g! O! t
ns_marquee.document.close()* V- \) V! F; w1 @1 n( N" O
actualwidth=ns_marquee.document.width2 i. j; d) u' T- U
}
4 R& i5 e$ d% v9 R/ Qlefttime=setInterval("scrollmarquee()",20)
1 P% I4 B. N, O  R2 Q}- ~3 _2 q0 ?9 T
window.onload=populate
% j/ K0 {7 L5 \1 @) R* k! D" o9 Y* v5 v0 A' B
function scrollmarquee(){
& T" n: H* z% e4 a& W) Dif (iedom){
; P7 M% `$ |6 f5 G- S0 U+ rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# r. O6 K* v$ p. `) v* _5 \" t8 _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% G2 f: z6 w. o& D& q" m, u- aelse
+ K; i6 @. R$ @# n9 k2 M  I" z4 qcross_marquee.style.left=marqueewidth+8
' ~# ]/ d+ r% V1 ?. ~  G# T* Q2 U5 O) x& t  \7 H
}) u7 v% w7 Z  @; G) O4 d
else if (document.layers){
4 n4 p, I1 q3 dif (ns_marquee.left>(actualwidth*(-1)+8))
7 |" A  |( @% cns_marquee.left-=copyspeed, I% V2 p( M- i- ~; _) p) r& C& x
else
2 l' W: w5 u2 l8 W; ans_marquee.left=marqueewidth+8
( m' a; [3 b# @( t" L) p}
- E+ I* ]* H3 W( t4 H}
( G, C. K2 g' J" {6 T$ j* o! ~' R2 L# x; T  z
if (iedom||document.layers){9 u. N2 u8 X, r8 {( G3 G7 f
with (document){
+ g- {- Y$ C- @* ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 e3 ^2 Y5 g9 `7 M$ A9 F
if (iedom){
3 h5 \9 M# m' Y% k6 g: ^* Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 r/ X: V. x# j+ T# f3 E5 cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" m' U) M) f/ U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 R, ~% g, T0 W$ @
write('</div>')
' o8 b6 N4 `9 v2 K: `) G% |- X5 t}
" b3 ^' `- _& Telse if (document.layers){0 l& \3 t8 H$ ^( {% o! w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 {4 X! U/ F% |: ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 ]5 B4 ]* U2 h% D3 Z5 l  ]write('</ilayer>')2 b0 E* V; b+ H6 _, A- m
}+ b0 S0 d3 I, j& l1 Q
document.write('</td></table>')$ m9 S- I) G  Z6 B& ^
}
" G; A& f- `/ N/ F$ j, Y" H: _}2 v" B( ~* k+ n" K
</script>

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