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

网页之跑马灯文字特效

//修改宽度9 f' }1 j* N! @- _
var marqueewidth=3009 E* V- J6 E$ s  f
//高度, W" G- ^1 M7 q8 T, [5 y
var marqueeheight=25
' S" p/ t$ O( Q" ]6 V, {//速度(1-10)
* X/ p& v$ {/ M+ G+ Bvar marqueespeed=3
  ^8 x* K. f- T* J% E3 B$ E  W//背景颜色
4 Z. Q- p: ^" W/ o6 c5 b( Qvar marqueebgcolor="#FFFFFF"
2 V# l( T' `" d//是否能暂停 (0=no. 1=yes)?4 t, O' H# R: P. Q& q& k( d0 V3 l
var pauseit=1
9 q' M; ^/ C9 y: a" G# {3 q5 H: q! e" ~  J5 S) I, {
//修改显示内容3 D: t6 A* E# O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& y0 `: h$ G/ ]$ w$ Z; B
+ m6 J9 i8 C4 a* q/ e+ d) x8 s
9 ]: q+ s* Q3 A" ]////下面不需改变////////////6 c+ ^( [; B, O$ [) N

7 ~& D7 g0 P$ B& ~2 {7 o" |( t' L/ ^var copyspeed=marqueespeed
; d$ `4 h, K4 ^- j+ e9 q5 Ovar pausespeed=(pauseit==0)? copyspeed: 0: x, s3 k4 E9 |* Z5 i: t1 f
var iedom=document.all||document.getElementById' z- N' ?5 c8 ^. }
if (iedom)
# q0 z) t& x- Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 |( K! _2 k( e
var actualwidth=''
7 a! Z" L3 R3 q: a* e+ V+ G8 Gvar cross_marquee, ns_marquee) G- U5 t5 w5 N! Q

: Q8 \* }9 Z7 G  ]1 a! vfunction populate(){$ r" H7 X7 l* U6 n# N" A
if (iedom){
4 b3 _' g; H, Q2 ?2 e/ Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 ~0 o) q- K1 w( t0 t( i6 M7 \) [cross_marquee.style.left=marqueewidth+8  Z' p4 ]6 b5 {% j7 l* j0 N6 z. O7 ]4 w! v
cross_marquee.innerHTML=marqueecontent  `2 x+ Y# q4 V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) S2 s$ j% c0 x. h. d. o" p' A}
4 k& c$ P0 l% W, C- Eelse if (document.layers){
% J- O: D. ^' D4 Y$ s; cns_marquee=document.ns_marquee.document.ns_marquee2
# Y3 [+ h5 K+ ans_marquee.left=marqueewidth+8$ i, D5 f6 j1 G9 f
ns_marquee.document.write(marqueecontent)
. A; M% N7 E, dns_marquee.document.close()
% v' s  O$ L$ H6 Wactualwidth=ns_marquee.document.width$ Y$ Y6 @' {# i- Z7 Q9 v3 v7 Q
}
$ J+ p, G; I2 a7 Jlefttime=setInterval("scrollmarquee()",20)/ `8 h( P4 Z7 J# h5 {& d; Q
}& J6 c9 N; [5 B) r
window.onload=populate
4 }( A0 p% o- T! ^' F( N* _4 ?. \0 E' v4 u: O- A! P
function scrollmarquee(){
$ E4 X! h* @; U  K1 Jif (iedom){; I6 L* E5 k8 {2 B% G4 D1 V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 ^. [) n  ]  a( V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: F1 ^: y: ~3 p: E" ]. Jelse. `$ U  y' X$ ^/ j$ _
cross_marquee.style.left=marqueewidth+8
4 ?! v! O+ A# S: A7 j0 Z& H' Y3 Q( v( H& M7 i/ Q
}
* R$ L+ o& o  `) xelse if (document.layers){1 j: W% N: s% N
if (ns_marquee.left>(actualwidth*(-1)+8))
# @& n' I" M+ I2 X4 Y' W4 Rns_marquee.left-=copyspeed
/ w: O4 h% n; p, S' l9 t" gelse
* ~" d4 ^/ X& C  g4 q7 [ns_marquee.left=marqueewidth+8- a2 r& [  F+ P3 D2 `
}
0 @  ]3 l" e& a5 p6 G3 [# |}6 o; C* _! E2 Q# U
  t: i! u* E& A* c! M
if (iedom||document.layers){
9 q) z( |) Q# h0 L, hwith (document){
2 q$ G. d0 L/ N6 f8 c) _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" g2 G0 f, ?0 ^( c8 A: e- N  Rif (iedom){. D0 D% v" E8 {% {5 ~2 p2 S8 d& T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 x! Q9 k5 G! C) f* E3 j6 W; Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! G( m+ c. E  uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( H/ Q5 \5 c& o/ E! \' X, D+ m
write('</div>')
# `3 O0 X# U& c) I1 _7 W, P0 J, t! V}: N8 U1 m0 I# E/ H! t# O
else if (document.layers){4 z2 k2 ~8 i* L' F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& @( N+ ~0 s, G- Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! Y  _) C- d2 iwrite('</ilayer>')' Z: m' L0 F. k% }: V+ W1 Q: o, j1 Y
}3 l4 [6 |6 Q6 T1 i" ~7 Z: i# {
document.write('</td></table>')
6 m$ ?/ v/ l/ C. J}
2 U$ U+ a/ X9 ?5 d1 [5 U}2 }4 d& N/ t( K& W' q8 ^7 A) [) c
</script>

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