返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, M! z, _2 s# y5 Y) ^var marqueewidth=300
  Y4 a2 ]. a8 J0 P, @//高度
% w# o, Q" y7 q' t' avar marqueeheight=25
, I2 P# w9 |5 C" \/ @$ k  i//速度(1-10)
1 @! ]7 k$ Z$ i) qvar marqueespeed=3" F- @0 L3 H) W4 J/ S9 N9 y6 e
//背景颜色
) @! y9 t+ f/ a; D/ A/ Bvar marqueebgcolor="#FFFFFF"; Z" N5 {2 O: W3 j( {
//是否能暂停 (0=no. 1=yes)?
7 V( j2 z# p+ j: R5 K8 Zvar pauseit=1. Z" U6 A2 Q9 e9 Y- {

! `2 f& B3 ]: d2 M4 k2 V//修改显示内容
% R' v- Z7 i" ~$ @. gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 W: A0 O2 L  T  A# }; ?" T2 E7 \- |
& X2 i' O3 G, r9 X+ _/ I: A; n# c
; u; ~& Q, u: w# e/ E/ `////下面不需改变////////////: P+ K3 ^) `7 F, p6 w) d+ j
1 n* T2 k8 n" V9 T
var copyspeed=marqueespeed' t5 U' M! K1 z" ?
var pausespeed=(pauseit==0)? copyspeed: 0# s* F& E& ]. M0 V, B
var iedom=document.all||document.getElementById* d% {  N: ]1 H' f
if (iedom)
1 h* J; k3 E0 C0 h1 x% Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 S& X# V8 |: t, X+ p) evar actualwidth=''$ Z/ i6 x! u9 Z1 R* `0 x0 o
var cross_marquee, ns_marquee+ J5 w! d; C1 W1 X3 y0 i" S
5 J* I5 M7 H' U$ |1 G! T; z$ \+ y
function populate(){: S# ^5 P% V4 u9 D8 _/ i5 |
if (iedom){
: Q) {$ y, u" n( dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: X- Y0 ^* W8 v- o3 K' wcross_marquee.style.left=marqueewidth+8$ E  W" f& H3 T0 E. n
cross_marquee.innerHTML=marqueecontent4 e8 p' M6 w( `; Q3 n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ A. B" c9 Z: C2 d9 F& x" j
}3 j0 ]' L3 u& i: z
else if (document.layers){" T$ n+ P, }5 Y! X% p0 c
ns_marquee=document.ns_marquee.document.ns_marquee2
( H) F8 V$ W8 }9 R, D6 D( s) Ans_marquee.left=marqueewidth+8- d. {% L- Y8 |+ t" a' {  a( A
ns_marquee.document.write(marqueecontent)
7 Q3 D# n4 J8 B' ~. yns_marquee.document.close()
0 R( u5 X. ]  ~$ u. @actualwidth=ns_marquee.document.width9 g+ J8 g8 e- v
}; |* f* D( y! @0 R( w+ k
lefttime=setInterval("scrollmarquee()",20)
, r" n1 x9 {2 Y" w/ q9 [+ H5 y0 Y}. d7 m. C; v% A" j1 @* D3 b' N
window.onload=populate
: z+ f: r; l) r; Y3 Z# {6 W6 I6 O7 N/ e
function scrollmarquee(){
2 H! {" U( n/ B# E" V2 Z8 Q0 T' [if (iedom){
8 X5 F6 v8 f8 y) ]+ n' l2 d$ }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* P: @& |% \- U2 P/ f# p7 w1 Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ X" ^2 v/ h% N& s5 ~) }* c6 G
else! ?/ `8 e8 i1 O# t  I9 L
cross_marquee.style.left=marqueewidth+8
- e4 T0 d2 j# B+ q) h. h6 @
! o* y: O0 f! w6 }}; a/ r% G/ t: S7 q; X# R
else if (document.layers){
* T: M6 v; R3 K* N2 h4 S9 bif (ns_marquee.left>(actualwidth*(-1)+8))
4 @" _0 p8 C- _3 l$ k/ pns_marquee.left-=copyspeed
( ?" W9 W: R7 Y5 j$ Melse6 {( j. ~2 T5 Y1 d
ns_marquee.left=marqueewidth+8: s. x. j1 p% e
}+ {. O% f5 @9 q: k2 K
}
  p! G& Z# h+ U& }0 [: ]; W3 A% Z
if (iedom||document.layers){5 g# |+ Y" K% v7 B0 M" J  l5 S
with (document){
, p$ ^9 y6 ^( J, z* g1 Z& A4 L0 jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ ]* m5 l& Y/ f4 v' g- s) y0 Fif (iedom){
$ J$ ]% C( D" |; b; X: |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 ~0 V. u" i7 D4 \& mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ b! ?! a+ b/ s8 N9 ^) Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' W9 m( R% d: f8 Y, Y( z+ w8 ~" D7 q
write('</div>')
' L  K' P/ u( W" W, E1 Y8 q}! d. b3 p) a% V6 R5 ]3 r/ ?$ {
else if (document.layers){
( [. ~  C. U! }/ X' I: \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 K1 y# P& K2 T* @! rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: S' D+ k$ |$ h( Cwrite('</ilayer>')
/ Y5 Z' F5 G9 b" ~}
$ K' b4 H, s) `6 p1 W3 U3 Idocument.write('</td></table>')$ \2 d: ~# _( O& d
}# W' u6 Q2 b4 u3 g$ A6 [
}
# B+ u/ L# g5 O</script>

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