返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' t- P7 W8 L" ^4 B, {4 R% @$ nvar marqueewidth=3003 y" b( s/ _0 M: V8 W+ g; |
//高度
' G5 Z8 R+ H; @, F0 A+ |; y6 ^var marqueeheight=255 v2 j, f& p! c8 n$ y
//速度(1-10)
9 w: n7 ^/ c; a+ nvar marqueespeed=3
6 ~3 e' R$ g  U0 x7 K: O3 Z( h//背景颜色% Z& k; |" s* c. q7 ~& |0 y
var marqueebgcolor="#FFFFFF"9 a. o/ \* d* p3 p0 B: j8 K3 |
//是否能暂停 (0=no. 1=yes)?
' K0 ~- M0 s& jvar pauseit=1
- I7 C5 u0 F$ K3 |# G% v/ R- b6 {) S( A: k* G
//修改显示内容! H. I/ C4 n5 F' O/ w4 k& Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" e4 f! o! q$ |- {# N- K6 {
2 }/ U# y- L5 {' e( y+ `8 s) @. F' d/ p: w
////下面不需改变////////////
7 ^3 V) S6 r1 F* w' i
5 w) u3 b# I. C) i4 U& D$ lvar copyspeed=marqueespeed8 @9 k5 y/ u, D5 o8 _4 _9 P
var pausespeed=(pauseit==0)? copyspeed: 0" z5 J  R/ k% s9 D8 L' w' f
var iedom=document.all||document.getElementById
! z& ~" W( `+ [6 n  Nif (iedom)
9 \& Y+ b8 Y* {- O7 Y2 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 \9 V5 y4 Z% |. ^var actualwidth=''# u4 n1 R- V; }$ W1 b* @
var cross_marquee, ns_marquee6 C; i& Y/ f- ]7 J

6 t; h/ a5 }8 J5 T" Z4 B  K( n4 Ffunction populate(){
7 I4 R0 p% g5 a* [3 D/ [if (iedom){+ `6 J. K% W0 W5 Z5 T6 s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 B; u" O2 f5 |( q2 `  Qcross_marquee.style.left=marqueewidth+8
2 {3 g4 N; f% `cross_marquee.innerHTML=marqueecontent
  r  h/ E, M! C9 N/ \: yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; M8 h5 Y5 d4 X1 a$ h' ?}2 C8 N3 }* x! M2 Y& s  {. P" d
else if (document.layers){9 B, E) M6 S$ ~: z) n
ns_marquee=document.ns_marquee.document.ns_marquee25 V0 \) N% d1 T3 o
ns_marquee.left=marqueewidth+8
4 h+ t2 d8 A" l6 k* l! Bns_marquee.document.write(marqueecontent)
9 E- y* x) t4 |ns_marquee.document.close()
/ }: ~- S. n% T( Kactualwidth=ns_marquee.document.width
/ z. J3 \7 o6 y1 T3 V}
" q" Z1 K9 U" `/ b. J5 L! b! {lefttime=setInterval("scrollmarquee()",20)
- Y& X" T7 X: D. R! Q, E}. J* z/ z$ Q. M" u$ Y
window.onload=populate8 ~: R! p+ V( O4 Y
! o# E- `, L1 _0 ^7 o% z  I
function scrollmarquee(){% `4 O* _; f& r
if (iedom){/ w% E! v+ O3 b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* n; k- @; |  E5 i8 w6 K# ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# g/ ?' W8 Z3 U# telse
+ |5 C7 }  K# r4 w! O) ]' r. Pcross_marquee.style.left=marqueewidth+8$ e6 H& \3 m) I- W& c" E
/ v% w# q8 ?  V7 [7 I
}* P4 N6 ?- T0 I# [
else if (document.layers){% P! W/ ]) a+ ?8 ?
if (ns_marquee.left>(actualwidth*(-1)+8))
# P) u: h: s% v! Y) a# }. y  ans_marquee.left-=copyspeed! Q8 }0 k! |/ z% G9 [  k7 z! m1 u- @
else
5 m  B- n; x0 e3 Pns_marquee.left=marqueewidth+8
% F3 k# X! j; [" y) {. t: H4 n}
+ S* H' ]4 Y+ O$ [* A}! }" [( u- O0 p9 s0 R
5 p; k1 u/ F7 P* S! G" A
if (iedom||document.layers){
" x4 E& m/ D! ^) pwith (document){" k" `  E# Z& S8 Y( F' n; H( S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( ?. O! F0 Z' u9 `5 K8 l- ?if (iedom){" N* z7 ?" p3 E% t+ J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, I; g: \, {1 |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 E: _, v' s: `5 {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" s0 w5 e" p* S: t- T* w1 |5 r& O
write('</div>')/ t4 |$ N$ q6 {  f# X* W
}
3 I  @# R% [9 {* a0 H: eelse if (document.layers){
: r9 K' f3 ^! n( t3 D; Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. j. p- L* d; L( p0 I1 l& ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 \( m. w1 f8 Q: @
write('</ilayer>')  u- Y- {# m0 @  P: {2 T
}) c* K2 C# [. Z) s/ L; m' L
document.write('</td></table>')6 p( f6 l. y) E8 N! O% A7 H+ [* S
}
& n0 |7 O2 ]8 i$ b5 y}
* S, c5 ?* A8 ]1 ^% u</script>

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