获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: B$ ]8 e, b0 f5 N* u6 u: G$ v) xvar marqueewidth=300/ x+ N* [, B" R% c& d
//高度
* C+ e) X1 ~: Gvar marqueeheight=255 U, H! J  `7 m! H
//速度(1-10). d" O+ V( P0 E' R0 ?" @
var marqueespeed=34 G+ z+ s3 J" F, C
//背景颜色
; V; p5 e! r) ?  j( Y- V* hvar marqueebgcolor="#FFFFFF"
6 o$ h( F! s2 n//是否能暂停 (0=no. 1=yes)?! w5 D/ {9 S; M% T7 l! I' d
var pauseit=1
: @1 D% t) T# S0 t; i; Y4 ~/ l8 O5 D" G" _  M; E: N& l8 w
//修改显示内容5 i5 h, P0 C. g% @8 q+ N# S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. ~: ]  L* T8 p4 [7 T+ E

9 K- H* \) M, x. ]3 I
5 R! t, G4 h3 I1 ~; d////下面不需改变////////////
% y7 j" I, h6 z8 @2 l% N% A" M" g6 V! _+ L( T# {+ y8 ]+ K& ?6 J
var copyspeed=marqueespeed
; n; W; I( n; y' Q& bvar pausespeed=(pauseit==0)? copyspeed: 02 z, z1 D* @* l4 Z! K7 y  q
var iedom=document.all||document.getElementById" E1 Z" I4 S4 Y0 ^3 z3 _
if (iedom)1 v; R' I( u9 Q" q  ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 M3 B. _+ X0 D' {5 v- N# i# B, E9 q
var actualwidth=''
3 B3 y0 \4 t! g9 Z7 u" Ivar cross_marquee, ns_marquee
, D" c+ N& a! L) @# S* q7 S$ B8 J3 \) y: n! x
function populate(){9 x# r" e% a7 ~/ Y$ y  b2 K
if (iedom){
8 f  m- o5 ^/ B, i& v8 l4 C: B" Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: C7 ~7 m& \: q  W, M6 Vcross_marquee.style.left=marqueewidth+8$ k- Y# }4 l+ I' n
cross_marquee.innerHTML=marqueecontent+ g3 C0 v$ Q4 o# Z' o- p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 r5 F6 T& L# ]3 M}
2 q  i% G; C( G6 O; q& F' u, R1 i2 z  felse if (document.layers){" w8 i- ^4 |1 h! u8 j/ h
ns_marquee=document.ns_marquee.document.ns_marquee2' e/ Q+ C* K1 e  T8 C- D
ns_marquee.left=marqueewidth+83 y: k+ \) Q6 B- r6 p
ns_marquee.document.write(marqueecontent)2 x+ L2 b* @$ t
ns_marquee.document.close()
# b1 [0 ?0 d- T1 |8 b% g# e/ p5 ractualwidth=ns_marquee.document.width+ a4 q1 y* p5 Y
}5 v: C+ @( S- S9 n
lefttime=setInterval("scrollmarquee()",20)& N6 k- q/ b8 \5 W& i, @
}( U% E5 ?% u  s! ^  Q
window.onload=populate
( \% z) l, F; [9 |5 K3 W
3 V6 p. E" m* R) Gfunction scrollmarquee(){
0 `* {: k; {0 C  D" ?3 p+ Dif (iedom){
: c& y/ T3 D4 Y( o3 m9 Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) d" @9 O: @+ o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( w- C0 \9 M5 g* L8 J
else' D" _+ v+ g6 U) B- K1 U! H
cross_marquee.style.left=marqueewidth+81 S/ }8 Y5 a) D
/ o- R( Q8 W/ b! ~6 l
}! A  r8 o9 y2 t
else if (document.layers){- h" f+ m3 T4 f6 ]- h( |# k
if (ns_marquee.left>(actualwidth*(-1)+8)); g& J* q( X" `7 X3 t
ns_marquee.left-=copyspeed
3 w- W" o& P( B5 S+ Ielse$ ^+ s, V0 |4 |
ns_marquee.left=marqueewidth+89 [2 P* ?, s" M. H( ~; Y
}
9 ~0 o2 J# X$ R$ Q# [; \}; k3 p& M2 w' U. _9 Z4 t. s
7 t$ @8 l) i; q/ ]
if (iedom||document.layers){8 V. w* ^0 d" h
with (document){5 P" h3 s4 U2 x) ^" E/ C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ S- R2 ]- ]& V: v  [# w- s
if (iedom){
6 H. c& \1 `0 w" X$ [" M3 Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ K0 x$ n0 J2 v, f; Q( Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 S! d3 x6 X+ `2 H3 awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 T$ N+ @0 I2 w
write('</div>')% x1 g' b9 |9 c9 G/ y
}
( T5 \! e% Q  selse if (document.layers){2 ]6 s5 c1 h- Q" S* b" |+ g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 s7 x. U# ?) i1 c2 pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# v$ Z$ \' ?# {8 D
write('</ilayer>')) g8 E8 p. S# s* k7 S
}3 r' j6 w8 F1 {: ]6 g9 D4 ^
document.write('</td></table>')6 K, }6 F4 u5 s% X' \
}( B# k. G. |9 ~/ E  [" G  R" N
}
- F: l( x9 S; w( E) b  z0 A; v( Y</script>

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