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

网页之跑马灯文字特效

//修改宽度6 X% z3 g2 k. G7 ]5 _
var marqueewidth=300
+ V. ^$ h" p2 e) O, @( S" y//高度+ {+ ]7 z; O3 b3 h! u3 a
var marqueeheight=25
) _. M2 t7 R4 h8 Y7 x8 l) \//速度(1-10)1 w6 N( J7 l6 P% B1 A+ ~+ F- W7 m8 T
var marqueespeed=3
4 o- X4 V% f6 X; P# L//背景颜色
( v8 C3 a# f+ L/ gvar marqueebgcolor="#FFFFFF"& U: h) B2 F8 X6 h! }, Z; [
//是否能暂停 (0=no. 1=yes)?# w- o# E9 H  x5 j: D! @- f% ^
var pauseit=1) `* h! g9 v* i1 q

$ y. l9 J& \, X3 Y2 O: F. r6 F//修改显示内容
: ^, o, C4 J1 ^. A7 B8 Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 A* \4 r! y' R
* }5 A' M% N' U9 i' F. B  [& f7 y' L: M! w9 t& v1 M
////下面不需改变////////////
/ D/ b5 w$ `7 |; y0 j- P/ g, {3 P# J/ N4 O+ ~. {: l8 a
var copyspeed=marqueespeed
9 M  L$ V/ N4 w7 ~, e1 T4 N2 @var pausespeed=(pauseit==0)? copyspeed: 0% a, Z, T& z  `! q! w2 [
var iedom=document.all||document.getElementById
# R1 p  D3 ]8 ]. @+ Sif (iedom)
+ C' X/ c+ d0 r' l: Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 k" `4 o' C1 ?- Q3 Q& S: {& w& i
var actualwidth=''( N8 m; W+ @) c+ L$ U1 W
var cross_marquee, ns_marquee- @& u" A% _5 @1 v5 W9 `: P5 @
5 j5 f/ p! m1 a0 {
function populate(){
! e6 p  U! U9 N1 g* ^& N+ ~if (iedom){
8 p5 W& X2 H9 i( @1 W+ jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- E% b$ R8 J8 U& J/ Y; \& \
cross_marquee.style.left=marqueewidth+8; A* w: M- V& a  N; ~3 x# {: \
cross_marquee.innerHTML=marqueecontent8 m7 E8 I4 @+ x( ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 z: ?3 W9 e- K: @7 y1 ~4 E}  h4 ^7 N$ ~  L! T; i" M% Z! L
else if (document.layers){4 \2 k' i; x2 M0 F
ns_marquee=document.ns_marquee.document.ns_marquee2
/ @* A! a9 C4 r% S, m* h7 Nns_marquee.left=marqueewidth+8+ ?& A/ j% I' J* Z. B$ I
ns_marquee.document.write(marqueecontent)
1 b; r5 A7 Z7 l* }ns_marquee.document.close()9 b$ R* I( y: F
actualwidth=ns_marquee.document.width& v3 K$ J2 N5 D6 m
}
! L& U0 d! W8 F1 {" Wlefttime=setInterval("scrollmarquee()",20)1 J7 G7 @8 q: K
}8 ?5 c' l& k4 X( t$ q$ T
window.onload=populate0 S6 F1 f4 Z1 K( v" }5 Y
1 T. z6 r3 h+ o/ q2 _% d
function scrollmarquee(){
, Q+ V" @8 X. Z& q; Qif (iedom){
3 w3 @6 U- }7 A. qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( \9 ~# r7 K$ {4 g. m* Z( X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 n0 {8 R) C: g- z8 a7 I$ ^4 C
else
6 w  }8 q; R9 L! D) m6 x0 e# }cross_marquee.style.left=marqueewidth+8
- v1 }8 T0 F3 L9 d/ z$ j
+ r& y8 g$ P1 M+ L* X: i}
+ |* d& l9 |5 M0 U+ qelse if (document.layers){
  t0 m& _) g+ b0 Z) V, j( g& E8 Rif (ns_marquee.left>(actualwidth*(-1)+8))
# G4 ]7 K9 _  x. g4 q0 Q# Mns_marquee.left-=copyspeed
; ^8 U7 v  M$ ^: h8 w( ielse* D3 k  h) n1 n% Q  ]$ e
ns_marquee.left=marqueewidth+88 @4 Y6 G6 Z2 g! w4 Y# t2 P
}- S, g5 Z) S' y. j: l( ]* n
}+ t) W" z. C/ z7 r

* G/ U! P/ C2 I: lif (iedom||document.layers){
- g8 x7 s+ R: r( d* H+ C5 Y& }with (document){5 w0 ~7 n$ M0 s* U4 t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) d7 `3 m% X/ M$ I
if (iedom){) u. v2 l. C/ ~! F# w  O7 o! S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ Z4 q& F0 E" nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ h0 S1 f, i0 X, I4 X8 U/ o2 J9 A+ jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 t9 M2 q6 u( D& [
write('</div>')$ y9 |$ w. a" w- A
}
2 w" d  s  b7 Z, [else if (document.layers){6 l+ c. z9 p' h* Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 X0 y7 c' X& L5 Z8 o% z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% v8 p% K2 {# {5 `% x$ |0 j3 uwrite('</ilayer>')$ E5 D7 Q" h1 q, ^
}
7 D% D7 \( m! B! mdocument.write('</td></table>')
2 {: A5 Z* q9 k/ u2 ?+ @4 F6 i0 N}* P- o0 R, _" K, z
}
0 x' D; b  o1 Y/ Q4 t2 M( k3 a  P</script>

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