返回列表 发帖

网页之跑马灯文字特效

//修改宽度) F) R0 W8 L$ Q# H( V' v
var marqueewidth=3007 [% ]$ \# W& L, U2 v
//高度' o3 e+ {9 y9 p) C, M& W/ [5 j
var marqueeheight=251 }. C# c" n; \( d
//速度(1-10)
5 d7 j+ u$ d* z2 u% K% qvar marqueespeed=3
' A! R6 _9 T& ^' l, t: Q5 q//背景颜色4 x% [5 Z3 e+ K  T
var marqueebgcolor="#FFFFFF"
/ B( A' m5 f- ]- `//是否能暂停 (0=no. 1=yes)?3 Q2 q) H/ n( P) R; R
var pauseit=13 ]2 F5 V$ G0 G; z) T, U4 I& W

6 ~3 K: f+ K! i& x& Q" d//修改显示内容
2 k0 H/ g5 \! _# m! j# t$ Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. r3 Z% d% a! o* h" ]# i) T* `5 j. A6 @6 B$ @0 R5 V

8 o9 e5 h9 X* Z. F0 q8 O////下面不需改变////////////* v) T" T9 O9 U) L& E' f' R7 Z9 c' z
! p% {9 t8 ^& M! |4 a+ F
var copyspeed=marqueespeed& s0 N1 T6 C) I5 k
var pausespeed=(pauseit==0)? copyspeed: 0: P& A- Q2 R$ |2 A+ g" r2 ?
var iedom=document.all||document.getElementById1 Y' S8 d$ L3 }3 ~* g# T
if (iedom)! z4 n. B5 T) S3 O- W4 Z. h8 A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 d2 M  ?* o: D+ o3 N8 u
var actualwidth=''+ j3 n8 y. @+ G( ]9 _, O
var cross_marquee, ns_marquee1 r& e1 D, W8 ~/ K& N9 r
4 ?+ w  _3 U- G( y* c: s
function populate(){
/ K- w: i6 P: ~+ W+ X) Nif (iedom){
2 E# A! ^, e+ j+ Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 q5 O0 u! [' \# L1 icross_marquee.style.left=marqueewidth+86 C( u4 Y  j1 }
cross_marquee.innerHTML=marqueecontent; x6 [1 r1 P0 A8 G4 `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& _+ A7 ?9 w0 U. }6 M" i% C
}
0 t# w6 ~( S! O' P7 xelse if (document.layers){
# m% Z5 D* [7 p6 T$ O( y& T5 d1 nns_marquee=document.ns_marquee.document.ns_marquee2. ]! X: }5 h' A3 d" D  E0 o* i. A
ns_marquee.left=marqueewidth+8+ `3 K! G; n& `
ns_marquee.document.write(marqueecontent)$ [4 |, X3 R6 K. I0 i
ns_marquee.document.close()
; \/ }* X4 g) M- s" dactualwidth=ns_marquee.document.width4 H" i( ^" Y5 s- Z5 j  w2 e
}
/ F# e- Q7 q5 z' B6 Z1 jlefttime=setInterval("scrollmarquee()",20)
- V& ~4 Y' e2 }" p7 Q7 u}' }! a4 Y9 F; r. _. E2 w
window.onload=populate7 C; T5 q/ p+ f: ]3 H

0 s- `; L4 H0 }: M) ?( q9 e9 C; _function scrollmarquee(){* V9 @) h4 M. k6 h. ]! r" {! [
if (iedom){
' c' M; g/ m9 `& f% T0 mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ ^5 n; _9 e5 O+ n! F/ j4 }" ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% k+ }8 M- y- b1 G' W9 B
else
9 Y% n9 r" a/ ccross_marquee.style.left=marqueewidth+8" Q# g5 q5 L% `" e5 N

4 R) E% g6 K7 w) C}
+ f$ d2 t$ p/ t% `else if (document.layers){
5 f$ n/ _2 e/ Qif (ns_marquee.left>(actualwidth*(-1)+8))
8 C: K& f. f% Sns_marquee.left-=copyspeed
! _! g: B0 [7 N1 y0 G: l- selse
. r& H+ l9 ~$ ?0 P. {ns_marquee.left=marqueewidth+8
" _. e4 J( k+ y+ U7 E7 I! }. l}
6 e: J3 h8 y3 L! r! U. V) d}
9 w6 \1 t$ J( ^, G* H, I! F' ~5 e' Z$ {/ e& k
if (iedom||document.layers){
% Y: H% y. j* G4 X' k. j% M+ @2 iwith (document){/ @6 |& I. h& o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). U5 |2 d6 p2 c0 N$ A
if (iedom){
0 x8 j# H8 J- O) V9 M8 S9 Y/ Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% c6 c9 W+ [" P- ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  I4 c, @  f5 m0 P8 S( G6 v1 D# M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ O; i, ?: K/ e- S* @6 N) V/ S: V
write('</div>')
; h, _6 ?) f( J/ J! r! t6 `( O( e}
$ X1 M! T5 j8 M1 y* `8 g3 _else if (document.layers){" e' z) s9 p( c6 `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). F# Q7 U9 {+ r, c' \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  S. o3 D/ j5 T8 ~2 |8 f/ Iwrite('</ilayer>')3 S# i7 |3 |! O6 j2 i+ A) X
}5 B" g2 t2 Q7 y" o* s7 e
document.write('</td></table>')& o4 M7 L5 V. f$ ?0 p7 b( R$ m4 X
}
, S+ M0 O& S5 `+ k8 I}
7 J% `6 c6 e7 R3 D4 m9 U7 {8 L& Z</script>

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