返回列表 发帖

网页之跑马灯文字特效

//修改宽度: K1 {! I6 e: R$ w" j; n- \
var marqueewidth=300% g: t. `8 q) R
//高度* V% D& z2 r8 ?" \4 J% [9 C
var marqueeheight=25
1 Y" Z' B: H, l# x; e# ~+ \//速度(1-10)
6 ^" \; F* @5 [. U; V$ pvar marqueespeed=3
' ^* p' C# {8 C7 y: z//背景颜色
! s8 \! s% G- d  t/ M! S( {/ c! Qvar marqueebgcolor="#FFFFFF"
1 Y6 n, `: h) U6 ~//是否能暂停 (0=no. 1=yes)?- t; [% J1 X! l/ y) _
var pauseit=1
  F0 P7 Q- s! {0 R$ L3 p8 ?* \8 u# ~3 X1 e9 W$ @
//修改显示内容" o/ \4 L( n, x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! u) E! T5 X! S

8 }6 t% X; [- _  I4 K) w
) b7 E. \' [  {3 j3 e/ x& i////下面不需改变////////////, W- z/ R6 `5 C: g

- |& B# w" Y, i9 N, x' Uvar copyspeed=marqueespeed2 J8 C/ r( x3 Q5 g1 Q
var pausespeed=(pauseit==0)? copyspeed: 0* G, S/ Z6 l3 ]/ h, }
var iedom=document.all||document.getElementById
, m* \/ B# G! Z1 X4 _* ]: V- X! Uif (iedom)4 J( d3 ]) a% Y/ E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) d, [& F0 a9 v: J* lvar actualwidth=''+ \% Z+ ^2 A  j" G
var cross_marquee, ns_marquee
! C8 |* _8 R( `8 r3 h
7 v5 z+ z- {% \; \function populate(){# Y$ i. k% y7 L* m5 W3 q8 d
if (iedom){, _4 W" p: Q) F' C8 M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' I- r" O' y" d* {/ f+ v
cross_marquee.style.left=marqueewidth+8
) |* l9 Y' q- P( A* Ncross_marquee.innerHTML=marqueecontent3 a1 ^; M9 }! X( ~# I# |2 i" ]5 [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! J& d. {! E1 i% J- f" N7 ~
}* O# A/ [6 c+ b1 j
else if (document.layers){
4 t# w( h, B: X& fns_marquee=document.ns_marquee.document.ns_marquee2
0 S' {2 ^$ L: d, k% R. p, wns_marquee.left=marqueewidth+8
$ k+ i9 Y& @$ L( m5 M) Jns_marquee.document.write(marqueecontent)
/ t' V  j6 T) Z6 Dns_marquee.document.close()
$ v7 B5 M5 C7 O, yactualwidth=ns_marquee.document.width, J2 Z  l+ g2 ?, R4 ]& H" R
}
9 Q3 b, d+ `; k. p7 x6 x8 U& olefttime=setInterval("scrollmarquee()",20)
/ z; E/ n+ ?9 X3 ~}' X" Y: ~$ j7 O: _, _' F6 d
window.onload=populate7 c  ?4 B* m# @) G2 e

9 O$ g# s; E0 t( nfunction scrollmarquee(){( }* ?( }; X/ D' I1 L4 l2 g
if (iedom){
4 W/ b1 Q+ e/ b$ C! _, ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ I# i$ B$ R* @4 U0 @+ d( Y$ s$ Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ W- y% Z: P# a6 s- Oelse
7 v% ?$ _! \$ L! A: \6 ?5 `5 P( `cross_marquee.style.left=marqueewidth+8
  K) \+ g0 c2 A2 @# _
) a8 k& n' C3 R( v6 y}
2 C; z. F* t. V: |- {else if (document.layers){
& _1 ^- N; t- eif (ns_marquee.left>(actualwidth*(-1)+8)), E+ F3 W' u  A; ]+ l: ]! h
ns_marquee.left-=copyspeed8 }/ {. a- \# z9 h' L
else: ?( X8 S' m7 Q
ns_marquee.left=marqueewidth+82 X8 z- M7 R4 ?. C
}1 b1 h4 W4 K# Q( i
}
: n2 u/ w& k) O$ W* U( T! i8 I$ p' ?% z! {% B
if (iedom||document.layers){
; ?: b, [- _( u' Gwith (document){
" U5 Q; z/ [- {9 m& w: b- Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 {3 U) Y( a. Y) A. j6 u$ _0 W, z
if (iedom){
& S0 Z( l" U4 X) y+ swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 F6 O( a7 [4 \  awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 o( j+ A9 ^; O4 R: {% ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 E0 r/ O+ h- P8 t
write('</div>')6 E" F  _9 k  y* K1 |4 r# f
}6 ^! @) q+ I- R) P2 M6 O. Z  ^
else if (document.layers){
- r/ P  G. g5 o; Q6 fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' B9 P5 k! F3 \1 z& @6 [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% W, O! |- |5 P" {% ?- X# m- Owrite('</ilayer>')0 f% f' R+ M$ g
}. o. l- ~# i( o/ ]4 d  O
document.write('</td></table>')
! |$ L$ j, \* m5 E6 q2 R}
# H5 e; N" i; k$ y}; }. h- p. P" Q
</script>

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