返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 N5 Q+ x' a, I1 L. T6 Pvar marqueewidth=300; d' }7 N8 ?6 [6 H$ A
//高度6 S3 Q9 j; C4 Q
var marqueeheight=25# s) U8 z: I( R) F9 m/ D! V
//速度(1-10)
6 e7 p' R+ V" ?$ vvar marqueespeed=3/ f+ O6 f7 Y, \5 q. m! z
//背景颜色
3 }( K. u* _6 x! |, ^var marqueebgcolor="#FFFFFF"
. U' m6 e* b/ J4 [# \//是否能暂停 (0=no. 1=yes)?
- z; a( l8 J; q. Z+ l5 ?var pauseit=16 p  C8 X3 Z4 Q7 h2 I+ z
: \$ K( C% l5 s2 _  T4 O( n0 L) ?! h
//修改显示内容) n1 v+ |+ P, ]4 I6 P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& t: H) K' f' n; M/ @2 q5 o+ ?7 J7 x/ Y: i7 f

- S$ ~9 l% z! W# P////下面不需改变////////////
, X2 h- N+ s0 ^2 e" f. N& y" M9 v- _, ^+ P; k; Y2 {0 e
var copyspeed=marqueespeed$ R6 j" ]- ?5 q9 _5 c* l- w- ^7 m7 ^
var pausespeed=(pauseit==0)? copyspeed: 0
# I3 ]6 R4 P* S3 Z# {+ C! Ovar iedom=document.all||document.getElementById
( _7 f3 B6 I. k4 Tif (iedom)+ K$ g7 g5 B0 N1 Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 t6 C+ E* a8 Y, n6 h
var actualwidth=''3 u* M+ o5 x2 j/ p2 f. m
var cross_marquee, ns_marquee
( K2 ~" F8 W7 ~% C1 }* K% w* Z) E6 Q8 h4 l% R- r; Z
function populate(){# I0 z+ p2 I- d4 V
if (iedom){
* k! K5 j( G0 @' y, R5 ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 V2 O+ P2 H, B1 U$ W( ^4 i
cross_marquee.style.left=marqueewidth+8
( q: j) g4 K4 U6 Tcross_marquee.innerHTML=marqueecontent
* @( a" M- H3 A. l! u" h! Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" b8 Q6 t; Z+ Z) {}
3 V$ a% {- d1 H- S! D) Q' F. ]else if (document.layers){. O; b& R+ U# i  s! ]3 R' B
ns_marquee=document.ns_marquee.document.ns_marquee2
2 Q( x& C2 e* q, Z( q# k+ ^ns_marquee.left=marqueewidth+89 q6 w) W1 V+ ~4 p) b7 P
ns_marquee.document.write(marqueecontent)
6 `7 Y8 |: t% Sns_marquee.document.close()
" ?) L: O5 Q& `3 dactualwidth=ns_marquee.document.width
. R7 f8 n& u0 z) C# E}
: P6 V2 e4 ~  [- Q6 H+ l' Klefttime=setInterval("scrollmarquee()",20)! M' m( W5 Q) Y8 S' \$ r0 U  b* G
}- y1 P. ]4 x/ g& d0 {* x
window.onload=populate
) T) ~( Z  Y+ U' \* L5 k, D  m8 s$ y( U1 k6 B1 o7 b( @; h
function scrollmarquee(){
7 t- k- z7 S' e; R5 vif (iedom){
' J' M* F: y' e' p% z( Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 k+ P  o" }6 j% `; n: c) Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( L$ T# G+ s) U5 yelse
: J* m9 d3 z0 Y8 o7 ~cross_marquee.style.left=marqueewidth+8
6 ~) l3 k/ H* y7 C0 f7 j* L0 e2 q$ x' p1 Q1 u$ v% P
}; @7 q5 N; l# E( p- R
else if (document.layers){
5 B* |( }4 D0 P% r1 Uif (ns_marquee.left>(actualwidth*(-1)+8)). U' Q; E# W/ q- K
ns_marquee.left-=copyspeed$ ], Y5 j& I" B; M
else
3 Q* H/ ?7 d2 hns_marquee.left=marqueewidth+88 S# G9 @; S& e2 b4 H5 s" g
}
! p6 O3 C1 [6 y+ J/ q}2 y" C. k8 U7 n* ^' r
2 _! y' h5 {" A
if (iedom||document.layers){9 m. a  L: |. E! e; f
with (document){
* g6 ]2 ]' }( G! ]$ l; \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ @2 L7 G# j& t
if (iedom){
% ]# _1 w) H6 t4 F7 X3 u! Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- q! n9 k4 v% c! @7 |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! w& E' r1 d3 ?+ jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 Y8 ]/ ]2 g; o, Z) k3 l0 O. L9 d- I
write('</div>')
1 j. ?$ i- ]5 L$ B3 G' H& \- i4 `}
3 @$ H; T  g# j! C# I0 celse if (document.layers){
7 j6 y) l' y) Q. Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- L' h8 K% v; b1 W4 f' t0 G3 [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) E% N4 k; T  [1 h% ]
write('</ilayer>')4 {: s7 x6 E5 R
}* C. ^8 P4 C) o3 y
document.write('</td></table>')
) g5 o3 a' \% O$ a9 B}2 a( j, Y+ _+ x# b
}" h0 X& `, M2 I1 H
</script>

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