返回列表 发帖

网页之跑马灯文字特效

//修改宽度" S0 O; x" S& l
var marqueewidth=300& y& m+ K3 v5 v& ~
//高度7 x. c' E/ J8 c) Q( v
var marqueeheight=25
" M' C0 A% o; B. T//速度(1-10)1 G4 R" U2 Y1 ?: ]. N+ e
var marqueespeed=3+ O  y; I: |1 O4 X
//背景颜色
( a6 e) f5 i. b% Z; i/ F! Q2 E, Avar marqueebgcolor="#FFFFFF"* }  C4 N; u9 V8 H/ _/ P4 N5 c' O
//是否能暂停 (0=no. 1=yes)?
$ B5 H( B2 R, K, cvar pauseit=1# K8 R$ G. ~6 H- n0 z+ M

% \+ [8 F- e6 g9 ^# I//修改显示内容+ Y3 z+ N1 E- G, {& x+ @' \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ {  p) R8 r/ [- ^- c0 u

1 W. p$ \( E5 F$ P& i& E' E& x3 ]8 S9 D; v; H# k
////下面不需改变////////////
- @, m. L! U, w3 a, |0 e& G0 f' k/ K7 Z& w( {) A
var copyspeed=marqueespeed
0 u5 f0 U6 t' ?$ s. m" D; Wvar pausespeed=(pauseit==0)? copyspeed: 0
3 M: R5 k% t' _1 J8 j( Hvar iedom=document.all||document.getElementById
" U$ O8 X* \7 x5 v1 T0 Qif (iedom)
* H6 \5 C9 m* _7 J* O- n3 k  zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ N5 q" w. E2 L& v8 Tvar actualwidth=''
; |% G1 R( D) M- tvar cross_marquee, ns_marquee7 i0 X; g* W3 {; Y  {

3 y0 j5 S  {$ ?: E8 ~function populate(){
: B( C  ]& K: b* O+ @. uif (iedom){: C, y2 z3 [, C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; }" B2 r4 v  f7 a8 y- y, k7 hcross_marquee.style.left=marqueewidth+8
% R3 [' C& y, h% }1 @cross_marquee.innerHTML=marqueecontent% R# l# @2 x' k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ p6 h* {& n, |5 N& a1 a# S2 i}
$ V1 H- _3 f8 B& I* x: }, Eelse if (document.layers){7 o" s3 l: o5 N6 q6 A( B
ns_marquee=document.ns_marquee.document.ns_marquee22 ?7 e1 K& a% D  j  N
ns_marquee.left=marqueewidth+8; W& K& x0 n0 {2 c8 T  O
ns_marquee.document.write(marqueecontent)
+ r1 E8 I% M# N9 ?1 p$ Z8 sns_marquee.document.close()- J9 t1 y- z4 C8 e% r
actualwidth=ns_marquee.document.width" f$ D+ v6 v1 d3 h
}
( ], j4 p& ~; B* V* r! X" _! Llefttime=setInterval("scrollmarquee()",20)
! o; D% Y% `# }! Q}
" N* ~2 k4 N" |* F, A+ X0 ~window.onload=populate. Q# \9 r: `$ `7 Z% ]6 J1 @
6 E( w  R8 c* ^+ o3 \
function scrollmarquee(){
4 k- L$ K7 l5 ~if (iedom){
; z) {" Z/ l% ^! q% `. F  s# |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( x5 k" _/ R, f2 V% l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 I7 @$ }0 W, v  U0 i
else
- D: o0 s3 z7 ]" Y" j; ccross_marquee.style.left=marqueewidth+8
$ p( X5 z$ z" W  q8 C
) m; f, `' C# J  u6 S! g5 e5 @1 i$ u/ X}( E; s+ T9 g2 ]# F7 e
else if (document.layers){5 s  U) F8 }/ v, u3 B( J- _$ {0 R
if (ns_marquee.left>(actualwidth*(-1)+8))
- D( d/ q( R$ ~3 e+ E' _4 o  Qns_marquee.left-=copyspeed# S9 k' v! R1 W9 b% c: @
else
4 D, E! U* T7 {" ^) J$ xns_marquee.left=marqueewidth+8
) t! J4 G- E6 r  \) p9 E}4 _! e. a6 ]* W: e
}  d  C9 r6 p' f& T/ n! u' n' N. X
/ y" x: @& P9 F2 F9 _0 u" D& U
if (iedom||document.layers){
* U" i% U% a2 v5 [with (document){1 y/ M4 |2 M# H# S8 x& L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" H: `; s% B# N$ s1 v4 Q- sif (iedom){
1 \5 N5 u/ L& n# O& cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& Y# B- x- b1 L; b: zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' F: _+ o" ?# M; ^; K. T2 Y( q% `4 j9 J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# m; h! J6 W/ j) w8 \write('</div>')9 L# q7 z# @" }' R% ~2 M! }' e
}
6 u( H1 y) _2 H5 }2 D) g$ W: Oelse if (document.layers){
" B( R" h0 i  d/ o* c, d3 C: twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- _8 K# d3 Q1 k  ]* Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  `% Z9 P+ r6 P! }; W, H) Y
write('</ilayer>')
, l8 n, R; O3 c+ \/ x8 U* h}7 @$ j  b1 v; ?/ [. T% ?: e, H
document.write('</td></table>')
& ^! o6 }& t8 _% g- W' e}
8 W' R7 N" V9 i}: `0 l" R  p5 H( p8 I. u
</script>

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