返回列表 发帖

网页之跑马灯文字特效

//修改宽度( h5 N& X. _8 d, `
var marqueewidth=300. r4 q+ j4 [( O2 E; a- u
//高度
  z9 V& S2 _  q5 xvar marqueeheight=255 X, }% m+ t( y) V- r
//速度(1-10)  J0 H; m, o- L  ~+ r9 H$ U9 v
var marqueespeed=3
1 {& {" H: x3 p( a//背景颜色
0 j7 }& g2 k" a4 ^: ^( Evar marqueebgcolor="#FFFFFF"
& A5 l3 B# N) L' c( K% H% r- }//是否能暂停 (0=no. 1=yes)?  Q' x4 e  A- e9 g6 h  l' |8 u, p
var pauseit=1% p: }7 n5 @7 \

4 z1 L& L7 K2 f# i//修改显示内容! I8 w7 w3 R) G1 n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ M+ }1 a0 B1 [9 g6 ~" g
' h0 x; C6 ?# c# O% {6 l7 p

* b5 M' @8 s/ n( r5 H% n' z2 d0 m& f////下面不需改变////////////. ]. ^3 E: ]: p: b

# y1 b- O1 Q! g1 m: Lvar copyspeed=marqueespeed7 d1 ~. P+ i/ n; o7 K
var pausespeed=(pauseit==0)? copyspeed: 03 l8 F8 ]$ F# M! b5 j) ^$ i; ?
var iedom=document.all||document.getElementById$ W, ^: |$ H& }& y4 A# J0 [
if (iedom)) t) d, d  D8 O4 Z' T0 d  |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ E' U4 X/ e. W: p8 Nvar actualwidth=''
& F3 O6 ^* n( `6 F  Cvar cross_marquee, ns_marquee$ X: Q, ^# w, R: J* _) W2 s$ ?* [; @

* o7 Z' C" |$ E3 Y6 O; M! {. @function populate(){
& @. _9 _4 b! W+ g2 C' iif (iedom){
9 e7 q7 U5 P  n3 I6 h2 d% M1 Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; H. e+ q8 Y/ |4 R, |( Q) T
cross_marquee.style.left=marqueewidth+8
9 t7 t7 F! Z. |: `3 z% P: W; \cross_marquee.innerHTML=marqueecontent
" L1 f" H$ L0 r8 m1 b. }  M5 kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  Y* \) T0 c9 [" x- V, g0 T/ I
}3 d, _" n6 S1 W: S
else if (document.layers){
5 x+ u, Z0 x) a/ F6 \ns_marquee=document.ns_marquee.document.ns_marquee2
. i5 R. @" r+ u  V$ V- Yns_marquee.left=marqueewidth+8) l! X1 }& J% k
ns_marquee.document.write(marqueecontent)
/ w) A- i$ B! g1 }2 A! w, l- O' Uns_marquee.document.close()( O( ^) ?! v9 Y: v4 w% Q
actualwidth=ns_marquee.document.width) [! }7 c1 Z3 t, C; _; K
}7 W9 O# E- W% J7 Y0 w- `
lefttime=setInterval("scrollmarquee()",20)
% K# [8 o4 C) v( O6 C! i}
4 d; |1 X4 ^) ]2 @window.onload=populate
0 [/ w0 t& ?5 d/ J& [( S* V9 q/ D, ]6 n5 J, N# w7 F. K6 X* f
function scrollmarquee(){
0 ]" y/ v! [) jif (iedom){
; j/ O0 \3 H, K/ [* b9 |% _- cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) e8 g: }9 Z1 m$ dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" A' D: g' r: `% `8 H1 ^$ j; s
else
: d5 u) _3 c! N8 fcross_marquee.style.left=marqueewidth+8% l- D: t3 \7 O4 i

; c9 q8 Y! F' {}
+ C: Y) L3 |- J( [$ I1 relse if (document.layers){
8 }$ M& G- q0 _; xif (ns_marquee.left>(actualwidth*(-1)+8))0 V6 z: O5 o9 K* f
ns_marquee.left-=copyspeed$ U* k& D, W& A0 T: i! g! u# X
else0 D* L$ X$ u$ J, G
ns_marquee.left=marqueewidth+8
. c/ Q' }. ?) w5 ], S, O}% v- {/ }  n/ V
}  i+ X  J# m/ j5 X9 W; c' S
3 f$ V! P) w& M6 l
if (iedom||document.layers){
- ?5 l! p9 U( F) Hwith (document){
$ w$ g. ]- E4 j6 V0 `, j" jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- Z1 k# p  R2 o  ]7 y: b; ^8 Mif (iedom){
- C2 |. [; Y, y: F8 Z8 gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 X" r: p9 E$ }% xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( v& i0 _# @, f) @# X+ F% r7 O- z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 c$ l( C( E5 c' S/ Y
write('</div>')
2 c0 c3 i; s: d6 l" W1 u. l4 I}: F, A- j0 s$ [' l2 P8 d
else if (document.layers){! {" k& M0 `2 P1 y) D% d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) Y. `. L: m; N( k' R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 j! U6 g6 y0 C; Fwrite('</ilayer>')* s7 e' V2 P( Q) X
}7 s* V8 @3 ]/ |( H. c5 I
document.write('</td></table>')4 n0 _- K7 G, w- h+ x! ^
}
. ?# L5 h/ d* B2 I: V; E" g}
" T1 b2 ?4 M+ k0 i6 b- G</script>

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