返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( p# Q% [1 b4 d! N+ ivar marqueewidth=300
3 Q/ s; o# e9 b//高度+ C) L& H, B# F$ {$ `
var marqueeheight=253 v, a1 x# o* o$ V
//速度(1-10)
2 H: J4 ^" z5 g4 U& G/ Mvar marqueespeed=3
0 U/ c+ H- H2 h1 [* C//背景颜色6 _' D# L: U# z+ r+ m3 T( M, ~
var marqueebgcolor="#FFFFFF", D. b2 [4 O1 d- i% q  J
//是否能暂停 (0=no. 1=yes)?9 l  z! h: n! Y& P
var pauseit=1- h; k2 n9 U, y" f
! J" @$ r. }/ a% N  m) Z
//修改显示内容5 Z" v! F* g+ l; B5 ^5 K: {: ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) {0 T$ r/ X: k1 \
- `- b' C3 y2 S7 d' O! a
% g$ `: C, L! a8 N% l" ~1 i3 _////下面不需改变////////////
! ^# n# N: z/ q/ X: O: W1 V7 S4 g
var copyspeed=marqueespeed2 D0 j& n  f4 p, t4 }; q
var pausespeed=(pauseit==0)? copyspeed: 0" q' |, D- U! ^5 G& R
var iedom=document.all||document.getElementById
  G7 L2 O: }" i4 }; D# @  g& P6 xif (iedom). u4 e' s3 [" r6 f! e1 C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  d$ o" E- N3 i# C& Kvar actualwidth=''
) C4 K( f" k/ U* j. X  q( N% W6 tvar cross_marquee, ns_marquee& O0 w; l( `0 e- m% i

$ R0 O  N  `( I* p5 v" ffunction populate(){
6 o% J4 c9 T7 A/ B, {7 U5 `+ `' Vif (iedom){# L: \8 X+ M# d) @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: f! K) E* n7 n6 Y4 a, Rcross_marquee.style.left=marqueewidth+8" d0 A, P6 N' p# {; M
cross_marquee.innerHTML=marqueecontent
+ l3 i$ i  S1 |3 S' c0 [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# @; A5 q% u: y9 ?
}, n0 f, ]2 `3 r' x
else if (document.layers){/ U6 Q! C) H$ W0 u
ns_marquee=document.ns_marquee.document.ns_marquee2+ D: x& p5 Q7 q0 J; g
ns_marquee.left=marqueewidth+80 q6 q+ F" }+ c: L
ns_marquee.document.write(marqueecontent)- v' K# Q+ b; T
ns_marquee.document.close()9 I+ e- F# `) i, q: l; o9 }
actualwidth=ns_marquee.document.width
' \) j# L3 o! \4 \1 s6 u& D: ^}
) z) e7 }' J8 c0 A3 Llefttime=setInterval("scrollmarquee()",20)
: h0 ~. r6 _7 j2 ?1 L}
: U6 m8 v1 R$ b! b% T- U! jwindow.onload=populate4 m* ?- ^3 m, A& d

7 J: \: @( |" o. B! n, L0 I! Cfunction scrollmarquee(){
# h! V; Z- Y/ g2 Mif (iedom){0 I6 w' K6 B( ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# ]; l: D8 t7 y/ ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" H0 x' k. }4 Q  D# z1 i
else
/ C3 J, f. `- ~7 L- R. a# p5 ~cross_marquee.style.left=marqueewidth+8
  P# q' e% L! B* q. I2 b9 l' d
' `3 I( L; h7 G7 _}) Q, F& V& ~9 m" m8 k! T" {2 G- o
else if (document.layers){
$ S2 P2 ]$ j4 W- O. O, Rif (ns_marquee.left>(actualwidth*(-1)+8))
; S& \: P! q" r9 mns_marquee.left-=copyspeed
% R8 ]) H; r; helse- F& _- U! k6 d, l5 x0 s
ns_marquee.left=marqueewidth+8% N: ~! j4 L, U3 z/ A
}# b7 ^$ v4 j) c
}3 G# G9 U* E+ u+ ]* ~

# s% W1 P0 O/ E# Jif (iedom||document.layers){
1 Q& K. g* \# t0 `with (document){
, D/ D1 S4 T* Y0 Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# M8 M2 k8 @7 G
if (iedom){4 M3 s0 ~( }# Y9 X) U4 x- X7 W7 _  Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 J  d; J& s! \  @# T0 w' `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ H' j+ X# z# |  a/ D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 g/ c0 m( g( {. N. D; ~* k
write('</div>')' U5 j: F( \2 d3 L! C8 t
}
' l8 d4 Q* p! |/ a  Oelse if (document.layers){
4 b' ?$ |! v. U2 `2 Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  i) O# H, i. ?8 Z1 g$ D+ l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) F, ^2 w, x! g" |write('</ilayer>')
3 w% Y  r  G6 s, Y1 [}
0 `- x% e/ m; fdocument.write('</td></table>')  j% I* ?: c& W1 e8 n
}
  g( \0 z; Z- N6 j0 m$ s; n' V% x0 g% h}
- F, Q' ~- {( y0 ?8 ^7 A/ J</script>

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