返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 r1 s0 Y& }4 F, s% pvar marqueewidth=300
; L# @- f9 N3 Y7 `* {//高度
+ q& C- {+ {5 M# t7 h, K) yvar marqueeheight=25
* W  f" ]3 j1 y! t8 l/ E' k//速度(1-10)
/ @$ ~3 L0 p; T1 \! w8 bvar marqueespeed=3
1 P2 v, v" K2 P//背景颜色
- H4 V. |! }2 W/ s) h6 Evar marqueebgcolor="#FFFFFF"
2 ]8 I$ j& [, s  U6 d1 v//是否能暂停 (0=no. 1=yes)?
) Q- h2 J5 ?. p3 w$ a+ O3 N( M$ Kvar pauseit=1
& k7 r$ [" R, v. }8 \7 V$ E  g$ F
, ~# m$ _" B$ u8 S& J; R  j( o//修改显示内容
# H( H9 x! m, ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! }9 Z1 O, h/ O6 v8 \* c' j% z  N. N- M- t+ n0 r
% H4 v/ E4 j0 x5 K' u
////下面不需改变////////////. d" [' F( |8 P5 @* z( N2 P2 n

, h/ Q4 z: q' a* z- Gvar copyspeed=marqueespeed4 T: P( {; a! m# H3 _" ^7 {( b
var pausespeed=(pauseit==0)? copyspeed: 0- s2 Y+ N( h( b0 ?8 h5 q. E
var iedom=document.all||document.getElementById4 T, s: q) Y6 P5 j8 u
if (iedom)* @6 R) s# d8 t6 b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 i6 [" h% {4 R
var actualwidth=''
" X# f: o; p+ Lvar cross_marquee, ns_marquee
$ N# x( u  S: c# [7 x% F" |7 |. f- R8 d9 s
function populate(){
, f- X# C' f8 G4 a1 Yif (iedom){
, M( W5 V: {/ B/ Z! k$ A0 W* ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) y4 Q# |; m- U' D, |- Lcross_marquee.style.left=marqueewidth+8* ^, R( w8 X& q
cross_marquee.innerHTML=marqueecontent9 D: I5 _; k* l$ ]5 M1 l7 g$ Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, J  W& m- X7 g) E}
( l) X5 I5 C  F0 j( e0 Z( Belse if (document.layers){* ~6 V$ w1 y' s( t/ P' P
ns_marquee=document.ns_marquee.document.ns_marquee2
/ W5 j3 ?" H8 Y" W( i  w! nns_marquee.left=marqueewidth+8
: U% w: O. i% o1 B6 ]- J5 @1 w' Pns_marquee.document.write(marqueecontent)6 K7 J( u& p3 P9 a) g. f& [4 @
ns_marquee.document.close()( Y# n- A! q$ \, ~  _! _3 m- H
actualwidth=ns_marquee.document.width9 n2 H4 j7 q5 A+ Q3 k) `9 a
}
0 U& l* L- A  m5 U7 y4 E4 l1 V5 olefttime=setInterval("scrollmarquee()",20)
. P- Y: i# i: |. R' T( \}
7 U- G, ^! i9 e& H1 J( ^window.onload=populate
  L' E2 L# c. J/ ^0 {4 ^4 x" @8 s9 `7 |; a) L( v0 r
function scrollmarquee(){
  W& t5 A. U8 @- y2 hif (iedom){, p) K4 i( j1 W2 b: G5 T, _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  L2 t7 u8 q0 s+ ?( @8 ?) `$ vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: ^2 S3 O& E. N0 r8 M% E; G+ O9 M
else( t6 N3 ]5 ?; m2 p+ o
cross_marquee.style.left=marqueewidth+8/ `& F3 U( Y$ [: c' S( u, z$ ~% f

: i' i1 m4 g& I}' Z  P1 V8 C3 j
else if (document.layers){
' w( k: }4 c/ G" z/ ~if (ns_marquee.left>(actualwidth*(-1)+8))
3 `" E: S: x- k# D& Cns_marquee.left-=copyspeed7 s2 V) M* v8 I5 t( ^
else
: [7 `, I7 N3 z; G5 xns_marquee.left=marqueewidth+8
4 {) @& O  {+ a7 H8 I, H' V}
) R6 C8 b7 t; k" P}# |1 g" O& W" g

( Y( f) n, T( r" a1 {if (iedom||document.layers){+ r+ i0 ~( A7 S$ Q- }- ?# U: u
with (document){
' m) b7 X( o; @! J8 l" _6 Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) j* m- o- R7 {% W) M: y- i* p" _" G
if (iedom){) R) A9 @! _4 j; B) F! ]# Q& o$ [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 `0 J8 G, l$ Z6 bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! ~; t4 B* _! J8 Q, uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 t, X+ k# b; E6 P0 p* _write('</div>')- t/ e' U9 ^2 f
}
$ E8 ~% _( {6 ~. u. s( _else if (document.layers){
/ [  f& @/ D0 i0 O: D' `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 {3 t# N5 r, j! }- ?( ?0 n* kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 c( w- y+ ^" L3 v$ G, T& d7 p9 b5 hwrite('</ilayer>')
4 c1 C- c% I7 B* Y+ i/ O0 d}2 t: [4 L: h! R1 w5 Z) R
document.write('</td></table>')
* H: q/ E7 K2 n}3 N6 g+ R9 T) e
}
/ C- Q! D, |- V' K</script>

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