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

网页之跑马灯文字特效

//修改宽度
5 J7 Y8 p: w* h% _" ]8 Pvar marqueewidth=3000 M; L% r+ E, j3 U* k
//高度
3 S1 E8 \: ^+ C, S; X+ qvar marqueeheight=25
# d) y  E, Y, z0 F. J5 p4 P) A3 |//速度(1-10)
. V: @5 n6 _8 ^# j+ a5 ?# ~9 svar marqueespeed=3
% n4 A2 ?" X8 G$ B//背景颜色) g  F* ~' n9 I1 y
var marqueebgcolor="#FFFFFF"- L& Z" m" j3 o/ C
//是否能暂停 (0=no. 1=yes)?
; j. o/ \" M3 E0 Y: rvar pauseit=1
4 Q( m" T+ m/ ~1 _+ x; d
* r* r7 m5 m  ^+ k//修改显示内容. N: _% B8 g5 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 A( S: t% E  A4 P/ c- J
5 t0 Z* X& u" q6 {& e" U
" i$ i9 P1 O: O# Y. a) X4 B% E' w
////下面不需改变////////////
- {; |8 s: S  j' C
5 l9 a! \2 I/ G( A* B3 j! l* Kvar copyspeed=marqueespeed' k) i, ?0 m' e/ Y7 Q8 r
var pausespeed=(pauseit==0)? copyspeed: 09 f  r8 ~) |6 r+ _
var iedom=document.all||document.getElementById$ [9 t. o8 o5 v7 m& C# r& P8 z0 h' P
if (iedom)9 p! w8 B; x2 s! [6 L: R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" z$ A+ B0 ^4 c. M+ o: _# ?
var actualwidth=''
3 _7 d: R8 X$ s: a! `0 y; g- yvar cross_marquee, ns_marquee# L- z# H9 U) i+ j
! X6 w- r7 ~2 g0 w2 x
function populate(){
) W7 k0 N7 i, `1 c5 yif (iedom){2 s1 c; I% c) S9 Q% @# D; d1 ]6 d" F3 @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  ^8 {+ T3 Z" S, |8 e$ ~cross_marquee.style.left=marqueewidth+8
0 a  ?; _5 B: \5 k8 I1 p. x6 g! Ncross_marquee.innerHTML=marqueecontent
3 i9 P: n" y5 |/ wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 n+ N! t) v- S% B  u" {0 Q}7 t3 {! E- f7 J: o. {
else if (document.layers){
& |9 f1 S/ [5 K; vns_marquee=document.ns_marquee.document.ns_marquee2+ k4 Y9 i2 U% o2 @0 C
ns_marquee.left=marqueewidth+8
: B4 P" w6 }" Y. m2 @. vns_marquee.document.write(marqueecontent)3 b' M3 I3 X3 E* F9 n- ~
ns_marquee.document.close()1 V; b! B3 A/ L
actualwidth=ns_marquee.document.width& e/ D9 {+ s8 k
}0 T9 q0 X7 e# x  c0 f8 s) h- i
lefttime=setInterval("scrollmarquee()",20)  F, ^) t2 @$ k. A$ N+ g- C
}0 R/ C, j* o1 g2 i- `
window.onload=populate" k3 n* d% X! b; @! z( f6 H. J
* v" }+ O9 L# L# L7 u# V6 ]
function scrollmarquee(){
. H; m4 j- n2 b5 e# C* uif (iedom){# l' z0 B: i' `+ }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 S: L8 B7 R9 d- Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  l* ]/ a& h, ~, K  ?. {
else
# w+ X& ?6 f8 z2 z0 Q' o9 z. y: ncross_marquee.style.left=marqueewidth+8$ A- n6 w5 ~* h1 v/ J
; V& y! M4 K0 X4 _( e: F
}
5 }8 t* ^# t1 k" @8 F+ delse if (document.layers){
  g0 ~# w) n( _. s0 P- y# Eif (ns_marquee.left>(actualwidth*(-1)+8))" j# G" l, I: t0 F9 f+ T
ns_marquee.left-=copyspeed
+ c1 O5 c9 j' ]* [6 @' {* celse* f( S7 W  ^. U; p
ns_marquee.left=marqueewidth+8
) f% d% H* w! K: R/ Z}
- b& `3 U+ N: o% y( M! q/ y}$ X! ?6 ?( Z" c, X( q* p
2 z0 `- E$ _; x* B. Q% l+ e
if (iedom||document.layers){
! A. C: E* a. owith (document){
, |. E! A, `! e2 ^2 J8 m: Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; ~2 D- B* ?5 @# E  g' hif (iedom){
7 ~5 @2 @4 g" x9 d7 }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% m5 I, b; J% \. S( S; awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 Q! x* M0 X' S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# n7 R+ ^/ V2 M$ ~$ i6 Nwrite('</div>')
, n3 |) ^: B' c. ^2 M7 W}
1 j+ }7 d7 }) M+ Zelse if (document.layers){" z7 x. s: R3 `$ |: l8 y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( F7 F% T* y* B- Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 e" \4 P2 e% E7 _5 }
write('</ilayer>')  ]6 O9 p  u4 d2 d( J% D9 `
}
- g# ~* ?! Z  Xdocument.write('</td></table>')4 Q8 Z; @) G6 Y# k4 W9 e# ^
}
2 l; \+ F: ?! S' o; c) ?}1 O: x  R+ x+ h2 [2 N
</script>

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