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

网页之跑马灯文字特效

//修改宽度
8 |9 {7 j- m: cvar marqueewidth=300( m3 f7 @5 d! U0 p4 b2 J8 w3 e
//高度( L2 _& _9 l7 z% ~& d
var marqueeheight=25
4 @; {" R. v6 |  v' L5 F1 V5 V//速度(1-10): _! M; J  M% J
var marqueespeed=3
  g) c! y6 z# u9 w5 O0 k, y//背景颜色9 [+ g' s2 m8 U6 i! L
var marqueebgcolor="#FFFFFF"
  R% Y4 b( j. `- o//是否能暂停 (0=no. 1=yes)?
, t% f, |1 R. @2 P* o4 \' xvar pauseit=1
" {4 B  k6 h$ v
# r; ~2 a2 {" P2 n8 x//修改显示内容6 c& L4 [: P( g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 i+ ?5 L/ e8 S: T* L7 \

9 p% w- U: u+ B$ G; r$ G  Z: i# w6 Q" z; z: j' a$ [
////下面不需改变////////////
7 Y& u6 r7 J) }5 d( k
/ ?- w' I2 ~6 Y) z, ^" hvar copyspeed=marqueespeed. w# l8 g$ K0 g- \$ ~" f+ L  U
var pausespeed=(pauseit==0)? copyspeed: 02 X. w+ h8 F& E3 Z* p
var iedom=document.all||document.getElementById
9 C3 C" Z! ^% [0 ~* S, k3 ^if (iedom)$ ~8 D( c, ~+ J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 {; ]7 g2 h0 a% X. L  z* Y
var actualwidth=''
5 d* X0 \% X" ~var cross_marquee, ns_marquee: ~9 `% d; ]- C  ~
2 _5 L. L: I- B9 i
function populate(){' @$ D5 I! W* J' W) ^0 A
if (iedom){
$ I" B- p$ p# ]0 ]& k! fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, v. f0 [- }# {+ @# h, d) w
cross_marquee.style.left=marqueewidth+8
& L( C: U; P: O+ Z! }cross_marquee.innerHTML=marqueecontent9 J( Z/ I" o, k3 e2 w" d' m/ [( F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 r3 U9 |) e" `7 d$ g% R
}* u9 O! X. e& d% @  X6 I9 B
else if (document.layers){( I( c4 m. O; k* i7 D+ {
ns_marquee=document.ns_marquee.document.ns_marquee2
9 V# i$ @! N- U' F' n- Gns_marquee.left=marqueewidth+8' A; A4 |6 ?) J+ P  n* r* y* p
ns_marquee.document.write(marqueecontent): N, n% u0 O4 e/ Y  I
ns_marquee.document.close()- K9 {2 T3 z, }& h, ?, ]
actualwidth=ns_marquee.document.width
7 R/ ?- A7 Y7 X: D9 Q0 o0 ]) J7 @% _}  |2 D. \, h& P0 y
lefttime=setInterval("scrollmarquee()",20)/ a5 W  `7 E4 D; ~2 Z1 [
}
& ^- G' r2 M# Y1 Pwindow.onload=populate
  `( Z: j% Z- Q( f1 @/ @! J* B/ }0 J
function scrollmarquee(){& ^/ y& m4 z+ c1 Z- P7 C! p* V
if (iedom){
* E! e# t! F: a9 ?2 cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 E) z) O; U2 ~" ?$ across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# J+ b3 d. m/ J! M8 r& ]8 S3 velse8 k5 h  i) d0 L- R% X
cross_marquee.style.left=marqueewidth+8! r. K# v: T8 J) f
; j. {% ?4 |+ O7 }, w1 H; M
}# c7 H0 v, Z0 ^9 M$ C4 i
else if (document.layers){5 C5 O0 _) s* ?: Y6 g
if (ns_marquee.left>(actualwidth*(-1)+8))
  X) t2 [2 w. Ins_marquee.left-=copyspeed
. u0 v, H) V+ y2 felse
! n* ~3 x1 k* t8 fns_marquee.left=marqueewidth+8
3 ^$ a4 C3 }) i' P+ C& f}
: T3 H0 w6 N7 T, Q9 E}
' M, f2 Q+ [: k9 Q. R  M
$ c% Q* j+ t& @if (iedom||document.layers){
. s' I% O3 S8 A+ t- r7 t, wwith (document){! s7 I; K" L- l3 z5 T6 x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): ~" {+ q7 t9 b0 c% z
if (iedom){
" G" B3 d7 P. N8 }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: u. `% @8 q+ E: ^4 i, awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  Y. p' [7 z- uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' X0 K6 D3 a+ }* \  D
write('</div>')
* {/ u- R3 {. k8 R}; W, S9 O5 a' @
else if (document.layers){+ `8 C$ }8 }: j, l4 ]$ W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 I& K" G. u0 k+ y' V5 ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- W4 E- G& Y% |1 `& b  V& J5 gwrite('</ilayer>')
; F1 U* V1 _: m; t6 c& F' E* n6 |) @}
# Y. \( @+ y* I) Pdocument.write('</td></table>')
1 |8 r( v6 x6 P# m% I5 }, v$ \}
/ q- r$ t6 ~5 p- @5 M}
+ L$ g5 x; |+ c7 _8 f5 R4 y# _</script>

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