获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度& j; Q' H) |. |! ]
var marqueewidth=300) s% D2 x  p: \  G& l8 ]$ a
//高度
8 l& S0 F) v4 f. c) [: rvar marqueeheight=25& b% d& J* ?% L
//速度(1-10)
' X- x! A# H: P: zvar marqueespeed=36 D# ^7 V. b5 |+ [- p/ _
//背景颜色
, T( f; M2 f, Evar marqueebgcolor="#FFFFFF"  B3 V. M6 Y5 q4 E4 o
//是否能暂停 (0=no. 1=yes)?
" N' @+ `4 v1 A7 q, Z# Cvar pauseit=1* {* X% \1 u: g8 t( @7 d- ~/ s
+ ~7 `+ L! `( @/ @
//修改显示内容
/ N; V3 n/ m# G$ C6 C. q8 b; gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') Q* u0 W) P6 _' A0 M

6 c: l/ T# G' l  F4 z& `9 x
9 o$ M4 X5 @: r3 _( k* J: V////下面不需改变////////////5 \2 l, {& q+ [. h9 X$ R

. k, P6 u7 E# s) Z  c, Kvar copyspeed=marqueespeed4 p: j$ X/ |$ ^1 N$ h- b% f( e( ?
var pausespeed=(pauseit==0)? copyspeed: 0  P( t% j3 U6 V/ f4 u9 J7 e
var iedom=document.all||document.getElementById
! g3 T' y1 A3 f! Q. |/ Kif (iedom)$ k. X% Z% K# x& h+ [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) W& u3 A+ E( C, Uvar actualwidth=''
4 {) r' |  m/ n' M9 Gvar cross_marquee, ns_marquee/ [; ]7 }0 F1 t$ X! n7 x; t4 w

5 r) m# D  z# Sfunction populate(){
) |! ^- I, \7 I- s- v/ jif (iedom){
  c& h+ X' P5 P8 c) k$ c2 L# e/ ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: R9 ?1 J; |% @. E# x) _
cross_marquee.style.left=marqueewidth+8
  s1 Z. _1 ]: x+ \9 n. j' ?cross_marquee.innerHTML=marqueecontent
$ q: ?% q9 s! H/ F( u% Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ o8 o3 ^, Q8 e}1 W/ I5 O& y* g8 M  F. p$ Y
else if (document.layers){
% c* x2 A# [: @$ tns_marquee=document.ns_marquee.document.ns_marquee2
- }1 x0 E1 v; B) ?8 y2 M% w$ Ons_marquee.left=marqueewidth+8. }2 A6 X! n! j. o; }, O- Z
ns_marquee.document.write(marqueecontent)
3 U5 T- _$ x: r2 Y+ q$ yns_marquee.document.close()7 x+ Z) n$ ~# j, |
actualwidth=ns_marquee.document.width$ j0 o; b- k; d0 x! {
}, w: i$ d6 m& v* H0 B3 l
lefttime=setInterval("scrollmarquee()",20)+ h1 [# e. X- X) Y
}3 D/ n/ @5 _/ q: p0 z  u
window.onload=populate
% ]. @0 ]4 a. c, X8 ~3 H7 y8 G
, u- \: x* o  {! D, z9 B; M( lfunction scrollmarquee(){
, W6 v" R' Q8 z) j  Hif (iedom){
& Z8 }% R3 O/ f: }3 Z7 o4 `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" L  H5 I' R$ d: R$ Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 c! Z% A8 T# d1 c! b' r) melse
, M0 o1 D( x# T3 M* Ccross_marquee.style.left=marqueewidth+8. I# g2 A2 L2 x1 V6 u$ F
  |3 b5 e% |+ }' l
}( c( P& |! T* ?/ A( D
else if (document.layers){
2 E/ d2 T  U: C" z6 Mif (ns_marquee.left>(actualwidth*(-1)+8))
& G3 J' O% O4 |# T% M3 i( B3 Bns_marquee.left-=copyspeed/ k$ R9 ~; I+ y: ]# T7 _
else
0 L7 v) ?8 M. J. xns_marquee.left=marqueewidth+8
) I! B# \/ P+ f8 E}8 w8 g/ r7 I! h$ a
}
* R5 V- y/ i# l: b" M% G; R' V! w9 A
% m5 d) C2 d+ @# ]* m8 z  B$ \if (iedom||document.layers){- u  j1 \- [* I) j! p5 U
with (document){0 f% P5 N1 u  R; w" A
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, S) R) f9 H, q# _1 w0 {+ a0 Z$ _if (iedom){, Z2 N1 }' n6 F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ y" @$ M3 S) W4 C  U9 Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), S  O8 l& r6 P! z: M6 ~" o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% [0 _, b* y' Y2 a- h
write('</div>')
2 b1 P! V7 u+ v( v7 p9 y: b# H}
" G+ m* f" a' F( zelse if (document.layers){
; U  T8 |$ B$ f4 ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 ^) N- V2 h, p6 B2 s5 x# y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  l8 S% s8 }  N4 ?0 y4 iwrite('</ilayer>')
3 ~# P7 v! {6 ~8 V; y1 E}# W1 B4 m; P0 `' w, ~  s$ v  M
document.write('</td></table>')1 p3 ?  E. d$ A' x" d6 g
}
' G) K% D  B6 U- U, l}, D. D  y0 u+ G; k  ~; g3 f3 F" E* E
</script>

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