返回列表 发帖

网页之跑马灯文字特效

//修改宽度" a' {+ _6 y' j% ^' I
var marqueewidth=300) Y7 G+ D9 K& A6 n0 |3 b1 M2 v
//高度
, t8 @# I+ U+ Evar marqueeheight=255 l/ B* A+ \5 S( V6 w' K- c* K
//速度(1-10)
/ B" ~. K, j9 I" b; l! Xvar marqueespeed=3
: Q3 u* ^( V- ^* d( M- F//背景颜色1 x9 t7 _6 E7 d; U
var marqueebgcolor="#FFFFFF"
- k8 J  R# O, N0 T//是否能暂停 (0=no. 1=yes)?* Y& |# [. K. M  q) e2 h; x
var pauseit=1! G0 y( @8 {# s7 L8 Y( w: h, m7 _5 P# V

  D; T. X$ ?# Q//修改显示内容5 P8 m4 m9 N( y/ H. r, j$ r: O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 H& G; V2 {- u& ?4 Y9 I# V3 @7 U
$ m0 I* \; A; S' h& m/ ]! H/ N4 Q
////下面不需改变////////////
0 V' n2 l3 U( i. M( }5 A4 N' X& ]: b* `" Q
var copyspeed=marqueespeed! [2 E0 U! Y8 [
var pausespeed=(pauseit==0)? copyspeed: 0
0 D1 n  @, y6 {$ o, ovar iedom=document.all||document.getElementById
1 M1 N( F' P  H3 f+ k: N) _if (iedom)" I$ J# e& l1 O3 @+ }9 \4 [( {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% d* n5 y$ W$ ?. ~var actualwidth=''
8 d# ^% E6 G# ?: Dvar cross_marquee, ns_marquee9 W$ D5 ?0 p- m3 I

9 k% D1 t  ?/ s. B* T  Q# jfunction populate(){
8 ~- S, J) i" G. qif (iedom){2 v2 O- F% P+ |+ O4 ^2 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' K* D. M, k) q6 U8 C1 R+ |cross_marquee.style.left=marqueewidth+8  O3 E; O/ f3 |" S2 y
cross_marquee.innerHTML=marqueecontent
; ^' Y# {6 \# W: L; a* Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 g7 s- g. V, L7 r+ z% _}
# L. p  V. K1 F7 uelse if (document.layers){! B+ a0 x' \6 O+ x; O
ns_marquee=document.ns_marquee.document.ns_marquee2
' G7 v* E- z3 Pns_marquee.left=marqueewidth+8
# x) Q8 N8 h/ q8 ~1 q& ^7 v& Yns_marquee.document.write(marqueecontent)4 Y* r5 |9 Z9 i' |/ @3 E, X
ns_marquee.document.close()
# X7 U7 Q/ Z& J1 |# hactualwidth=ns_marquee.document.width) z- p# j; p( _/ E( F7 M6 |! r
}
0 W+ u1 l) }# tlefttime=setInterval("scrollmarquee()",20)$ g2 q7 B( a/ p
}/ ?+ @: `% p& y& ^6 G
window.onload=populate; y; |) `2 ?) b- i8 O) v2 G

8 e/ t$ U! M) |1 V0 P7 W) B) Y. y* Ffunction scrollmarquee(){* E& e' P) }* e
if (iedom){
) n3 O8 p6 {; z$ }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; i8 Q! |! ?0 J  l. zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! f5 c- N7 W( x. n7 Z* e
else: a1 [1 ]) Z( i, v; d4 Z
cross_marquee.style.left=marqueewidth+8
. Z. U. C: P* p# t4 j: _+ J/ v. K& h( ~! J
}
& D6 |* |% }4 Y$ ~$ k/ d0 q! velse if (document.layers){
/ ~# v6 T' f/ t* q& A6 D! l9 Iif (ns_marquee.left>(actualwidth*(-1)+8))+ j, E5 P: L# D
ns_marquee.left-=copyspeed
  w: Z3 T% N( \! G& g$ Y' D7 Q6 Lelse% M( {% W' j* _6 G5 A, H7 X
ns_marquee.left=marqueewidth+8
. c! \- h! z# Z}8 r* \4 Y% h# c* H
}
4 A# P& b$ U& t; X1 o, `0 z# G1 M1 w" N- K* n
if (iedom||document.layers){
. k  p+ v) W7 u8 _: V: q* kwith (document){
5 \+ o5 }& J* s/ j3 T! Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 g4 u, V( b3 O7 e# o" Nif (iedom){1 M3 ]' a4 d1 a- M! H' [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 \& O; S- ]7 ?/ e+ S+ ?3 O0 C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); d) p3 V$ T5 G' K5 C, n4 d4 F8 W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 K+ `: K/ ^6 e7 @8 V  c& A' J$ X4 ?write('</div>')
# q7 F/ h9 @2 M/ `) R0 a9 e}' [8 q# o, Z8 n& l# @
else if (document.layers){* J3 f1 F' d6 B0 y4 B% Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; ]  n6 V# }3 J7 Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% I1 f) z8 Z' @& l. v2 t6 {; [
write('</ilayer>')
8 ]7 d8 i1 C8 A2 d0 ]}% Y! i: ~& z; S' \: A# b
document.write('</td></table>')
  R- z# x& m- ?: I- g* z$ X}
0 H2 ~) Q) v. W0 N0 o% u}
! F- V* i$ G1 c5 [</script>

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