|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
6 F7 v7 y- Z# `' U# s) d* gvar marqueewidth=300, _' W8 [0 u* J+ k, q
//高度. u% A9 p1 |! M- q5 s! @
var marqueeheight=25, S& f9 e( G; c0 c* u
//速度(1-10)4 I- S- \6 j5 Z/ v- A ]- ]
var marqueespeed=37 j& A( x+ h# ?( K
//背景颜色0 a5 R- T+ X+ v! h" E: ?$ S: S
var marqueebgcolor="#FFFFFF"
& s/ y: s5 w0 P' @# y* g//是否能暂停 (0=no. 1=yes)?! H8 d( [1 t, Q3 D. v$ [
var pauseit=1
4 E, R- \$ ^# V( i t6 W1 o* p! y
. w( H! j/ X* ^5 J* t7 {: Z# F4 l//修改显示内容, t& V& N. P) k% B" G2 d- ?! L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ w8 O- C6 T a# P
# O7 u) I: y- j/ @) a4 W
9 @5 _" ]& _& Q- R. z7 R, S0 l////下面不需改变////////////
9 v4 S# J, G; i) u2 b8 A) @9 p9 l( [
var copyspeed=marqueespeed/ g$ f8 Z; b' f2 [8 }- O& Y
var pausespeed=(pauseit==0)? copyspeed: 0
3 \' }3 d0 \7 Gvar iedom=document.all||document.getElementById8 V' v4 Q* i! b- x; W3 I
if (iedom)
& Z% ^6 J) l# \5 R i$ qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ J+ [% H% ~2 O8 j2 b' t! X/ Svar actualwidth=''
% ~% u# W: @- h( s4 _var cross_marquee, ns_marquee
/ k3 ?* T3 Q. W6 E; Z4 w |
% e2 B5 w9 z' d# z6 V/ |9 tfunction populate(){
! k9 z' F( W5 z) L2 W# w- x5 P1 xif (iedom){. f/ D* j3 |& u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 `4 r% e1 F- V3 i" W& G! N! A
cross_marquee.style.left=marqueewidth+8
: \( y2 D7 B/ V1 h0 }8 C# Pcross_marquee.innerHTML=marqueecontent- Y2 W' g8 h& x' d" M0 k. |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 |2 h. I% H) F5 d
}: w. {; V' D9 `( F
else if (document.layers){; Z. k: f4 U! t3 z
ns_marquee=document.ns_marquee.document.ns_marquee2
, Z6 T) b9 } b6 p, L: sns_marquee.left=marqueewidth+8
6 I) \6 d+ v* L+ M& @# t, k5 t" D/ fns_marquee.document.write(marqueecontent)
7 F! a' n: y; Q# rns_marquee.document.close()% e* G' u$ n% z5 c* r0 d
actualwidth=ns_marquee.document.width
+ n4 v5 i+ [$ X, v}
% z; n) M3 p* V7 z7 olefttime=setInterval("scrollmarquee()",20)
" v4 ]' l* l8 H: s}- Q; O; r( B. _, G
window.onload=populate$ X9 m/ v) l6 Z q9 Q/ E
) ~* G$ ?' e& m$ c3 j% [% m
function scrollmarquee(){/ l& Q# w. D3 F' l: a8 W8 M
if (iedom){
/ L& ^3 ]8 T" i }# U& Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% `1 U7 k& x$ k& ^. W2 s, t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 A4 Q0 s, \% T- m, V% \6 J: i
else
' S! Q" b0 {+ S$ v% xcross_marquee.style.left=marqueewidth+8
k1 F5 f9 a( G
! v) J& b! ~5 K+ @& p}
- ~! E/ O( u" Celse if (document.layers){
* B4 s' S1 b$ [( b) e+ i( ~/ ]if (ns_marquee.left>(actualwidth*(-1)+8))
0 ^2 r0 y1 V9 ?: Z* O1 Ons_marquee.left-=copyspeed' O# i& j- A1 [4 \% a$ A1 f& L
else' \3 e4 i1 W% L+ l& \
ns_marquee.left=marqueewidth+8
+ C) G( l# e) z% @5 V* u; G}
: s! x9 _' t% ]' K! |, c1 ?}" |, J+ J: ?* R9 b. {% K
' j/ [6 p3 m0 b( I( Z9 S* O! v) ]$ G7 oif (iedom||document.layers){
# s. T. z* v* Q+ o, o# N3 K0 lwith (document){! Z9 [: u3 S( ~3 [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" V" I3 ]7 L; V5 a* s
if (iedom){
( u6 ]& S0 @" l! K& `5 h twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 t' c4 X" r3 `! Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. g H, r( z. @$ {3 fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. P. _! \. m0 e" }write('</div>')
7 X6 W+ R1 O3 e2 E# g5 W" }8 W}
. ^9 l5 }5 N& {0 h) ] J6 {else if (document.layers){
0 u% c, Y1 c- [2 Q* Y, M7 a' _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 _" y( ^% c E# A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 r6 n0 @. m! U# kwrite('</ilayer>')
) ?% E1 x. J- e: ?4 E% O1 U, Z}" K2 m5 G5 S' h; B
document.write('</td></table>')) T$ w. \9 \" ]6 E
}' _; y( z. }. S I
}3 [# Q' l0 ], F) X* E' \5 F
</script> |
|