返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 {3 U: O- h" l: r! T  `
var marqueewidth=300
* U; o5 n  c) _" Y# I//高度
9 U' c8 b& m8 G# Uvar marqueeheight=25
: o4 {( C" m, c4 G4 j//速度(1-10)
; H& c% I8 E6 F8 `0 R3 w$ Pvar marqueespeed=3
) M4 F6 {- g0 v' ~  \//背景颜色
9 ?9 a; F% g0 ~: jvar marqueebgcolor="#FFFFFF"9 v+ U1 X. T1 T! `2 S
//是否能暂停 (0=no. 1=yes)?* b  T& e7 ]6 d  X
var pauseit=1, R6 A2 `$ p( ^( r' j, ?

8 R! g0 l" s$ K: F& j! q6 ^//修改显示内容
. ?1 f/ D1 m4 c0 e0 Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ Y- e2 f* l6 C% q( q  O6 Q/ o
. o. }! A3 q% g; Q

! e4 Y0 g: G8 z( X7 s  a2 M6 s////下面不需改变////////////" t6 C7 C0 n$ v* a

. b4 C# n) M% q7 H4 {; s2 @) S/ w, ^var copyspeed=marqueespeed9 y2 Z9 ^% m  n
var pausespeed=(pauseit==0)? copyspeed: 03 j8 H$ _7 b6 r! M! J
var iedom=document.all||document.getElementById- {3 E  {  m/ `4 p# B! W) Z
if (iedom)
* P& F! k9 o, W! odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) p; a8 z- R) N0 I6 i$ I' T8 Vvar actualwidth=''+ _  Q4 A. @" d* J
var cross_marquee, ns_marquee
' B6 P) a0 m, |0 s+ }
/ P' \7 l8 s  Z) Ufunction populate(){
% e9 s0 m  z5 ?+ W. Wif (iedom){. K* s- f3 W% \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ ]9 W! {& ^! G1 I* c9 ~( W
cross_marquee.style.left=marqueewidth+8
4 e/ ^* e1 w# {. ]/ U: V2 a2 Wcross_marquee.innerHTML=marqueecontent- b8 Q# F, |! z1 x& f$ C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 x4 b" p2 b3 `, f6 f9 W2 J
}
! t  ^5 V5 ^$ g+ u( a0 i7 Qelse if (document.layers){
/ |: ?' `9 g) R8 \7 k+ n9 xns_marquee=document.ns_marquee.document.ns_marquee2
2 {! [8 L9 v4 F3 T& nns_marquee.left=marqueewidth+84 B5 g: w" D( |8 d
ns_marquee.document.write(marqueecontent). U2 ~! c1 W( w1 z' q
ns_marquee.document.close()2 E$ u5 f9 ~8 ?/ U% A
actualwidth=ns_marquee.document.width0 B6 j) t7 f- n
}
5 E- l, i& j/ y$ J( b5 L$ Klefttime=setInterval("scrollmarquee()",20)
! h$ R5 B* ]. Q& V4 C}
( A- ^4 r4 x( G' K9 E5 m# Fwindow.onload=populate
6 t# ]! [7 J  i! G% W8 c$ `; i% V1 c* y5 ^# K/ Q  |9 w
function scrollmarquee(){
8 ?" i- A: O2 M" E  v: E# u7 F6 t! iif (iedom){
' _" Q( o% f1 b' @0 I6 B* Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* Q  F3 P. p* {0 j- ]& hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 s3 F$ @" D0 ?8 Y
else
8 G3 A, i- D. z8 across_marquee.style.left=marqueewidth+8- [' Z- ^; k5 r7 _- ?

7 J+ Z4 U7 X" H. U* z! r  g+ c}2 h$ N) r* m0 V4 v. ]
else if (document.layers){# x" v+ g2 @& n" y) ^$ ~
if (ns_marquee.left>(actualwidth*(-1)+8))$ }( n+ h7 `& H: e' X( w
ns_marquee.left-=copyspeed7 W( O! A, E: A- l
else2 M' \5 X/ E' Z% K4 I6 Q$ d- e
ns_marquee.left=marqueewidth+8
' T& L( y5 B3 ~, g* I7 v}
! \1 G+ s: \9 g3 `}' Q* T0 Y: q& p
2 e1 x/ t( D8 h9 A/ A& n7 E
if (iedom||document.layers){' b# @' X# O( h, G" k
with (document){
' f0 y/ ?! x: S7 t" b5 Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 D8 _4 G2 r: a, Aif (iedom){) y/ Z* ?2 y) A6 @5 u4 B' T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ J# `6 M) X$ |5 N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# E! a# ~5 S; F" Z1 ], Z& M* ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: n7 i6 ^0 w2 ~( l% cwrite('</div>')
- y) Q4 h9 W, B. M5 a% Z6 O}' y: Y0 i1 d+ D, i! ?# ?  ?, o4 O6 ^
else if (document.layers){& ?2 n8 Z. c1 k( _' r1 f# F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& F) E4 d4 q& t; E, Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 s% F+ e2 y$ j" e1 S+ U, |5 u$ ^
write('</ilayer>')
: ~" o& Q$ b; v% Q}) X; J8 k6 d: ?! c& K2 {4 {
document.write('</td></table>')3 j6 _) d: d' B5 T% ?- D9 G% `6 @  m
}
% I1 O0 d1 n( J, p2 ?& J: S, I$ r1 u! z}
* ]8 ?$ e/ Q& Q. J8 m- ?$ E2 k- j9 m; c</script>

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