返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: R& }7 @1 |2 t; ]var marqueewidth=300
8 t5 x. f! [) S$ E1 g3 y: X//高度( n. G+ |- E4 Y' `
var marqueeheight=25' O' ^& w0 ^& v/ F
//速度(1-10)0 n0 Q4 j0 Z" O  s
var marqueespeed=3# e1 e3 O; o  M# o! O' G& I) d' S  o
//背景颜色8 v) D$ J) [8 f: O$ q0 v! z
var marqueebgcolor="#FFFFFF") y& S3 _  u6 C/ e. K
//是否能暂停 (0=no. 1=yes)?
5 |, z0 }+ G5 P5 F4 r" x) w; ^# t" ?var pauseit=1
9 }6 J' b8 q# A! ]) o! c1 f
0 N  Q0 I- @( J# F6 \$ D- ~" o5 M2 |9 b: D//修改显示内容
% f3 f* B# T! x. u1 uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ `- s; B6 c' c: u3 S7 q: s
; n$ D! L1 R) x& ~6 p7 S; D
# w8 n$ N7 _  L
////下面不需改变////////////
8 D5 n( S; j4 N  X7 q
1 `) j) r! Y" u8 t, ~) Dvar copyspeed=marqueespeed
3 A. k& U4 d) ?" H2 `& O$ Hvar pausespeed=(pauseit==0)? copyspeed: 0$ }* p: p. I, G! Z$ c0 D
var iedom=document.all||document.getElementById
. z2 B% P/ }/ C' cif (iedom)" B2 P6 N- A9 A, ^8 W$ a& ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 _& W, ]* T" U$ k! Q
var actualwidth='': t$ Z2 K# H2 O5 O( f$ X& n
var cross_marquee, ns_marquee
$ w9 K7 q6 ^! o, L8 n& D
' ~& V0 R, k. o/ ]8 cfunction populate(){8 n% E8 h; ^" `* h1 y
if (iedom){
$ m) y! \( ~! m/ v. _5 Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 @+ x5 b. y) v3 Ucross_marquee.style.left=marqueewidth+8
2 v7 I% C" L2 X( e: qcross_marquee.innerHTML=marqueecontent
; B- D; f5 s' z7 L7 ^0 k6 Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ e4 b' j9 O7 v8 |! U5 `( j+ m' ?}' ?5 {; n2 z/ ^. G: B# c
else if (document.layers){
8 S' `1 L8 [7 g  X% B9 N( K( vns_marquee=document.ns_marquee.document.ns_marquee2
3 j" ~  \" w7 Z& tns_marquee.left=marqueewidth+8
0 I8 o  P- t; m% d" ?ns_marquee.document.write(marqueecontent)
7 A$ b! L' e, B/ a0 ?4 P2 e' e. y" P; fns_marquee.document.close()
. v$ h" P4 ~6 H4 Uactualwidth=ns_marquee.document.width! \' M6 h2 f% ^% P) P* ~
}
0 c/ Y& `- O+ @& P" c7 ?lefttime=setInterval("scrollmarquee()",20)
% y- i4 u1 Z. l6 a5 c}$ y% Q; {, Q- S9 ]
window.onload=populate
, J, n0 u+ ]1 n& z) E8 G
% j# e$ O3 ]; F: f  G" U/ Ufunction scrollmarquee(){
  n/ U  Y5 |1 I. c' gif (iedom){  l+ _; W. C! c) M7 x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" w' h* x! Y# v# N* Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 ]* x6 [" y4 W9 P: i" u7 N# velse+ I' v6 x: q# z4 z4 G- i% }) r/ I
cross_marquee.style.left=marqueewidth+8
3 N$ L* ]) ?# E2 I# b5 o; F; g+ |" t) R
% c9 ], e+ D1 |}6 X4 \* E! |" W4 ]* {1 u0 {( X
else if (document.layers){" p$ |' k2 e. C4 o
if (ns_marquee.left>(actualwidth*(-1)+8))# S  u5 q( F/ \* j
ns_marquee.left-=copyspeed
( T$ \9 z( m% G7 velse
8 a- U+ R* l' [6 Uns_marquee.left=marqueewidth+8
$ Q; E5 [3 A0 C0 o& [0 ~' N2 ~* F}1 ~$ u2 _6 R; J0 J( ^
}
8 V7 d. e4 k+ d( s$ h6 H9 P/ Q8 Z$ `3 J
if (iedom||document.layers){0 s- n' d2 b% t7 T
with (document){
' z3 A5 l* k; B) }6 g+ d& e9 w% hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ S4 B- Y, k7 d5 [3 |  z. x7 a& o
if (iedom){
# X; M8 m3 \% a) P5 ~+ o0 e" `. owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  c( Z# ?4 B- ?$ `3 mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" m  w! g) A8 |- ^" o1 v, [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 [' g! t" [6 E* ?& ~' r3 d) W( vwrite('</div>'). x( A2 Y# a" l) q7 {, z6 i8 F
}
1 H6 J: E0 K  Q" R% x0 E! relse if (document.layers){
6 \) S$ ~9 a$ {: X) Q1 w- Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% q5 r7 F8 T2 A4 h* |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" J: A) ~  W7 C0 _9 j' k& [$ c
write('</ilayer>')
; w1 O6 m9 r; X) S3 M}+ |* b' k5 L: Z" U, L/ c" |
document.write('</td></table>')
6 V2 O' m( \/ n+ y' V, S}0 F, {" L6 w! G7 z" Z, O& F
}4 A. Z  Y% o: j7 p* H9 ]
</script>

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