返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ ?, E4 O2 G. C- a* \var marqueewidth=300! o7 H2 N  v: T$ I
//高度
$ @3 h( g& h! j; |' _/ D6 bvar marqueeheight=253 ^6 U2 H9 p9 e3 J
//速度(1-10)- U) R# ]3 q1 w
var marqueespeed=3
  _% E0 p: \; `2 K- g//背景颜色
5 N+ B' B; u. _6 m) d2 X& lvar marqueebgcolor="#FFFFFF"
  k% G/ \0 R+ J  c: f# v//是否能暂停 (0=no. 1=yes)?
, {7 H# [4 P% M0 ~7 f5 z9 Mvar pauseit=1
+ }0 d( F% G0 z2 b9 ], W" n
9 j4 h. c" y  r# F1 ]3 y. k# }. g% V8 ?//修改显示内容
) R% m9 b, \8 L5 U: F% e/ hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 e+ P! `8 j2 F, R

. S& ~, K% o( Q/ p& M. \& `  \6 x1 _% h$ Y9 n! w- |2 k$ F
////下面不需改变////////////9 D' h9 O; B6 ~+ J; S) M% K/ r2 e
2 S. v( H$ v& i- z
var copyspeed=marqueespeed1 }# A( r$ ]7 u3 Q4 T% c! W
var pausespeed=(pauseit==0)? copyspeed: 03 i' H, \  c" ]
var iedom=document.all||document.getElementById
3 {3 M$ E1 h& v+ g6 rif (iedom)
+ i4 V# t# q7 I& |, sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- I- U" g5 [  F2 g+ Z* D7 j
var actualwidth=''
6 [) Y6 W/ L9 dvar cross_marquee, ns_marquee
/ Z. u. i! R  J! Z6 H/ q" \! o0 @  F" [, L. J' h8 Y
function populate(){
0 P' d" r1 A0 w$ N/ mif (iedom){! b, E. ~# q  P4 b% L, J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 W: T8 L6 J+ I5 ]+ R) t8 u. y/ n, l5 Ucross_marquee.style.left=marqueewidth+8+ ?6 ?  k. F9 d4 t+ M
cross_marquee.innerHTML=marqueecontent
, w& N! t! M) ]/ K1 w/ ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 `: E. {( |: w' h6 k% w3 w
}
' Y- \. Z$ B' s, |* P4 ?+ melse if (document.layers){
: h- R: U" y$ E' L3 N+ i$ A: uns_marquee=document.ns_marquee.document.ns_marquee2( M# G) j/ F! l8 I. }& X+ }
ns_marquee.left=marqueewidth+8. E: l  g% a- h
ns_marquee.document.write(marqueecontent)
: T+ r# h' E3 ]ns_marquee.document.close()
2 \, \" V% ~$ q; O7 E0 n' Oactualwidth=ns_marquee.document.width
9 d/ E4 X6 S5 X2 U9 Q5 m1 A  t}
' W' j' M) y& Z* Mlefttime=setInterval("scrollmarquee()",20)
) w2 ~0 V) o9 ?  T2 W}
# r, d  @. j, W8 g9 c: O4 Uwindow.onload=populate
! G% Y6 k, t" J+ \8 }. P: k7 T& C  o- k. L
function scrollmarquee(){
% ?- ]$ C9 g$ S. fif (iedom){
/ y) H3 C4 ~6 |- `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): R, a" s) t4 N  H8 S8 l8 R1 }6 V8 X8 w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& y+ F0 L6 ^2 k5 T
else2 F+ @, U) I" A; T
cross_marquee.style.left=marqueewidth+8
+ _: u/ y( M; F2 N2 H# H1 \
0 b% S0 ^- K3 x! t1 `8 x}
6 Z" X- E& G5 ~% U2 m! O2 X9 Aelse if (document.layers){
& N' k6 e( F* l+ xif (ns_marquee.left>(actualwidth*(-1)+8))2 f+ l* p) }7 z, E! |- u
ns_marquee.left-=copyspeed1 d7 `5 h. v! T1 f8 y$ T" R
else
1 h4 |5 ]9 X5 n  g: X; \ns_marquee.left=marqueewidth+8. r4 U3 v# @0 V+ T2 V7 D
}4 D) G8 W: ^$ [9 x; X" U
}6 I, u7 s5 d7 v7 N# V
4 c+ e+ X4 B3 Y3 n: @. ]1 d& j
if (iedom||document.layers){
0 n; J" s; e. Lwith (document){
" N5 V4 p0 n3 K( }: {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  A' v6 s8 I+ L, c8 G, R3 \( S; O. m" fif (iedom){
) j. k  T: r3 o3 @& v, gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- u* ^0 \: @7 l, z. ^! k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* u! W) f; M6 q+ O! ^1 D  j2 i1 rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 L3 P" Y, y7 f( p7 x* M7 q3 zwrite('</div>')2 }% _! x1 W' G3 u# D0 n3 g* k
}
; l% S& K( B" Z! H+ E9 c+ }# uelse if (document.layers){9 O4 b0 R$ ~( Q% A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): G6 P1 z$ w' z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' r+ o& _( J6 r, U/ s8 y0 |7 \write('</ilayer>')  o$ U' h* u0 j; O. [
}
; e# b' s2 M+ t4 M3 p. Q, Hdocument.write('</td></table>'), g2 S/ q6 \9 u) W( e6 {/ g3 V
}
  s( `! x& ~6 M. L1 D7 e# G( C- ?}
/ M7 D$ n* E' b& A  f- m</script>

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