返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 H8 i) t2 X- t+ x6 U& h+ H
var marqueewidth=300
' u6 ~9 U  j8 o) Q//高度
* w- c+ [# S( Q" J1 u# w/ Vvar marqueeheight=25
2 z1 P* h+ ~' N//速度(1-10)5 j9 _" r6 F3 c: B0 I2 `
var marqueespeed=3. b6 W% B$ @. C+ U8 g0 G# Q/ E
//背景颜色0 @: [; a$ H, T# s
var marqueebgcolor="#FFFFFF"
6 p0 ?; t, \; ?, V9 |//是否能暂停 (0=no. 1=yes)?) e6 Y7 D0 D; s: d  s# ~4 L9 G
var pauseit=1
; Y- ]) G! j* [( x; |/ @
" y+ Q( j! B! f' L% E3 R//修改显示内容
! S$ P8 w8 C& gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! G2 W0 T7 z' N5 X+ v1 i7 e- W

1 t; Y% W' ]# W, g
$ f; K1 n7 H9 [$ b////下面不需改变////////////
' I: |) {! ~9 v$ P
0 i. L+ R  Y$ T! _4 @" |var copyspeed=marqueespeed
7 L# A$ U; ^. `* Y4 avar pausespeed=(pauseit==0)? copyspeed: 09 Q$ E2 q8 N/ ?7 F6 K& Z' ~. t
var iedom=document.all||document.getElementById" z$ g( a1 _( `+ F+ `; [
if (iedom)- i' B  h7 a' M/ b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), L5 c; c! K1 J$ A) |# Y. F; F
var actualwidth=''2 p8 k/ _! @5 T3 e
var cross_marquee, ns_marquee
+ R$ I+ V1 i* y
) c3 r# m1 U6 mfunction populate(){
- i# ^3 Y8 |6 c6 Tif (iedom){) l( S$ s& w6 d) W/ L" \( T! ^
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( e1 A9 w5 B1 v0 {' Icross_marquee.style.left=marqueewidth+84 G$ Q: H, c; W# _& Y
cross_marquee.innerHTML=marqueecontent4 B$ s) Z% M- \" o8 v/ e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: `5 m* _) h8 U7 t( V- Q}3 C! m3 h1 g" b' a  e4 k4 W
else if (document.layers){
% z1 N7 ~: s4 j9 Fns_marquee=document.ns_marquee.document.ns_marquee2
5 G# @3 H" V' I$ Uns_marquee.left=marqueewidth+8) p9 F( g! Z' ?+ i( A/ v
ns_marquee.document.write(marqueecontent)
$ f$ h0 N( g3 \. R+ B, x/ o  l  d3 E' sns_marquee.document.close()" h) B; b6 P6 R+ ~+ G+ R4 ?
actualwidth=ns_marquee.document.width
! P( `1 o- ^" R! [3 S}7 m5 @' m$ q; z4 k! ?" z
lefttime=setInterval("scrollmarquee()",20)
  B8 {7 z" b# E}' k1 A1 I. Z5 w$ G3 i( {" q
window.onload=populate; {5 N7 u$ b8 _7 m

& }! i9 ]& {- q$ `function scrollmarquee(){  I, K' c: h& \+ a# F+ _5 m
if (iedom){
& P; J- Z- c" |3 V' Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 C. i; j6 r. l" L. i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: ~4 u1 j+ ~4 r+ l: c
else  _* G% X) D* N. G" ]
cross_marquee.style.left=marqueewidth+8
- ^) L& y0 J/ C7 l4 H/ ~% S; w
% }7 ]8 N+ Y( X- y9 Q& H0 \}1 n) i2 I4 h9 B+ z6 W/ s* c
else if (document.layers){
" S0 e( L1 v# g6 S) Cif (ns_marquee.left>(actualwidth*(-1)+8))
) f* n% k+ I7 z1 c* Uns_marquee.left-=copyspeed( z8 ~4 P) v4 l% L* I  g
else
2 {" a+ S8 ?) a4 k9 m* Cns_marquee.left=marqueewidth+8
; `. C7 x$ K  M6 y6 o4 A}7 l' _$ B1 E0 B6 p0 u
}6 `' ]. M- F( C# ?4 ~, D

2 M: s2 ~3 W2 N# }& Tif (iedom||document.layers){2 k% H) P, y* `8 x# V3 w5 I) ^
with (document){
' d* a+ k8 w2 l" a7 edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& g6 L2 N4 _, u+ hif (iedom){. m% S2 j0 w! C; j  X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 l% [/ d* y$ o, c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' U) {( I" f* j- E% ^3 X- awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( f3 G+ C1 W) qwrite('</div>')4 @2 I# b2 C0 \9 A2 C0 V
}
  |& Y' }3 g/ z* [+ ielse if (document.layers){: v; B6 j9 ]7 l. c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% H1 ?. V( E7 ]2 I( s# t- owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! w# H/ t! [5 C5 ^
write('</ilayer>')
' b& s" r$ o( Z( R5 k+ T}
3 z: C$ R7 U/ V) ~% j5 Q6 {document.write('</td></table>')9 _3 X% m6 ^0 G7 b1 c! \
}
3 a8 o# e5 k( g2 [2 ^! ]( u" m& J}! f# Y1 M1 c8 e5 ]5 b2 n9 H, j
</script>

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