返回列表 发帖

网页之跑马灯文字特效

//修改宽度% |9 j7 k, ?% M9 h: h
var marqueewidth=300% h2 {) R5 o. j  ?
//高度
7 R! {5 v8 n2 I& X3 lvar marqueeheight=25- D: e5 M1 M) m/ {* @+ j
//速度(1-10)! L- }/ }$ W# X1 s' \
var marqueespeed=3  K/ Y$ {) y1 g- X$ @
//背景颜色
* _$ m" q. ^2 T! Vvar marqueebgcolor="#FFFFFF"
7 S  y* H. o6 N2 G) ~8 t: e//是否能暂停 (0=no. 1=yes)?- ^& f) [. c3 y" g. j; M$ e6 ?
var pauseit=18 w" |: H5 l2 ^9 `* p; m
4 y" m3 }: R5 L, H3 r& f. z
//修改显示内容
) M( j% C* X$ bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; k! G) r- l% x& ^: T/ y6 J5 E1 E/ k; l$ m
# k/ x8 J- [, Q6 [- r% `
////下面不需改变////////////
2 a. x/ I3 T% t/ S% q7 U: R. Y$ Q- [9 c8 x
var copyspeed=marqueespeed' N9 Y# a' e! F
var pausespeed=(pauseit==0)? copyspeed: 0
9 O' @4 n  q( M# w# i/ s( bvar iedom=document.all||document.getElementById8 h& P, a6 ?9 d  S; ]& L. z2 Z
if (iedom)
4 n8 }! {! D( W6 ^+ F# L6 Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% h+ C/ }4 K6 w2 X" f& M4 S
var actualwidth=''
* j. G7 j4 E% y* Avar cross_marquee, ns_marquee. W" E' y, }: }; V, ?* ~9 I6 g5 t

# B' f+ n8 f0 e5 |: Ffunction populate(){
0 k1 y+ q! U5 p' }2 ~- Fif (iedom){
% ?0 G2 F* a. R: ], {' {+ I* ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: `8 y) S8 ]$ k) d: ~, X
cross_marquee.style.left=marqueewidth+8
7 Z- a8 n8 K& jcross_marquee.innerHTML=marqueecontent
& d: I8 b% y. _+ c- O& Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  F& K5 j1 C4 Y}( q7 W9 o$ D" ~
else if (document.layers){) w" Q, t$ @1 {  r9 D
ns_marquee=document.ns_marquee.document.ns_marquee2" G( E6 p* _' O
ns_marquee.left=marqueewidth+8
9 X+ [: U: a2 x2 d% g% @" ]- j5 n) o/ Q6 Wns_marquee.document.write(marqueecontent): n1 @; q4 M9 C
ns_marquee.document.close()# U* I0 t) @$ {' B
actualwidth=ns_marquee.document.width
$ n! y# C9 p4 h% u8 V" j8 n8 d}3 y1 S% W3 a; i  G
lefttime=setInterval("scrollmarquee()",20). W9 Y1 g, ?1 z
}* H' ]  r- E4 G) I% A3 R
window.onload=populate
2 Z: s4 M6 E4 E+ N0 ?' T+ p5 a
" p- n, k0 i% j% g1 k! s/ m2 Jfunction scrollmarquee(){2 O4 z/ q1 H0 P3 X
if (iedom){7 j+ ^: d9 P& A0 x. ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 i* i: K5 h' J6 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# L2 a4 t) K! ?4 X
else
% z2 V: q* \2 p! dcross_marquee.style.left=marqueewidth+84 c: {+ g# G/ S

, }; n5 [, w. `' c" a9 V}6 `- p" X+ w6 d" H0 |  N
else if (document.layers){
& S; k7 y( R5 X: {: ?* j0 `3 Uif (ns_marquee.left>(actualwidth*(-1)+8))
) O. e+ v! c! ~- h7 Q2 ^, Kns_marquee.left-=copyspeed7 p( L; P. t7 v& j
else
! l6 q4 N9 f9 r! m" {+ Pns_marquee.left=marqueewidth+8- @8 h# d( f# N
}
" Y  |. F# D" G$ x" i+ a! Q. J  G* r}+ G- R; S4 e$ N& E! R. c" C. l9 N. z

+ J4 z7 |; {2 b+ Vif (iedom||document.layers){6 h9 A! |/ q  a' s9 s, o
with (document){/ Y/ D, W+ b' D7 D! g- `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' R- `' b$ n" r( j3 O1 H- L" e3 w
if (iedom){  @6 Z  q% C6 \- O, i6 H# }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' v% H# m' i1 a, p# u7 owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 F) @0 R! N9 V! k/ \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 [: d. ~  F% B7 j2 m3 pwrite('</div>')+ b+ o+ _3 S! J; h. ?6 ~4 H
}- ?2 p( g. y- M) F
else if (document.layers){- v1 e  o3 o* N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 T# X4 M% U! Q- Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: V) d! D- s. q! Q: g0 owrite('</ilayer>')6 s6 S6 y/ g8 O0 a$ M2 H6 X
}. v/ S6 ]1 i) r4 G% q0 u0 g6 Z- g
document.write('</td></table>')
- q1 V; T& \0 H- W6 w}
7 \9 W' a$ t7 H7 a* x}3 W, B$ D) U. q  O9 a
</script>

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