返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ y. b  S+ l5 B. m0 ?& M
var marqueewidth=300
* z3 ^  \$ ^( G' y. t! q, a//高度
0 g, u- G- A8 `) q# s  v) H$ kvar marqueeheight=25
6 X: |5 R* a. n! E' S. `. U//速度(1-10), \3 H& }* R) R/ B( s
var marqueespeed=3
9 w8 R6 o9 D3 N. A//背景颜色
' c* m$ i1 Q$ o5 e5 c0 Rvar marqueebgcolor="#FFFFFF"6 z3 Z1 ~- H0 r$ O! g" U9 H5 E; }
//是否能暂停 (0=no. 1=yes)?
  R  @0 O2 s: Q1 b; |var pauseit=1* W6 d* p* `1 K# P
" @1 r' n" k+ P" g+ S
//修改显示内容; b6 v7 U2 C4 K0 ~( L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# H1 v: |# E/ R2 |+ Q6 C, @! p* a& S& q

' U" X8 q* c8 g4 I/ D8 `1 M  k////下面不需改变////////////
7 G% X0 v" m" }4 o
6 m" ~, P( U7 A: Q1 k- Pvar copyspeed=marqueespeed
2 v  t" v$ m1 R# S, F2 C7 v' o5 \var pausespeed=(pauseit==0)? copyspeed: 0
* c0 j. D8 x1 n/ u+ evar iedom=document.all||document.getElementById3 K# `7 k; D, c5 N+ D# F9 c& x
if (iedom); D( `5 i' D2 Z, t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 i/ A; ~+ e1 [5 a9 V
var actualwidth='': K0 P& L; b5 z. v# U9 e( e# l) @/ W; j
var cross_marquee, ns_marquee
0 q% q* ?& {6 e- n% P5 ~1 F2 v6 L- c% t! G
function populate(){
! ~8 W) ]# i2 Uif (iedom){
" O/ }9 R7 T' g7 {cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 g. n, x! i% u9 q5 x
cross_marquee.style.left=marqueewidth+8
0 w/ d; w) ]  P6 E: i4 k0 [cross_marquee.innerHTML=marqueecontent
* ?- }/ H3 O  f: D- vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, A2 M- a7 _- O9 Y1 t}
  S9 h/ A# J- O1 J; ]/ Lelse if (document.layers){
  U' J/ c4 \1 M4 W' D" q3 v4 Lns_marquee=document.ns_marquee.document.ns_marquee2
# O+ s& o" o" dns_marquee.left=marqueewidth+8% z  ^! b9 F$ r) i+ Y
ns_marquee.document.write(marqueecontent)
. a$ F0 ]% e, q8 p  q0 o4 k  Nns_marquee.document.close()' {; k* Y0 Z4 n5 A
actualwidth=ns_marquee.document.width) G% l4 S, ^  }/ O4 Z) w9 j
}# G( q4 P! t* p! h& m: F" d- U$ M
lefttime=setInterval("scrollmarquee()",20)
" P1 J' y: S# t1 T  S. |1 s}
. B' L4 {* F; ]% O. Ewindow.onload=populate* s! _# t1 x* U6 V6 l5 E* X% U
* r7 o8 M! m+ b3 R% [6 Z6 k0 x$ }
function scrollmarquee(){
% O  V. ?" ?& V! k: g9 {3 y, n) c/ x0 bif (iedom){) K- L/ W: A) Z3 j1 L+ A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ ~  x9 x; T" @1 e' O8 b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 D4 s  Z( s: ~; A
else
' W  a1 B# @9 W) x* n8 `8 Y; dcross_marquee.style.left=marqueewidth+85 V# Y2 B0 G- `+ G! q% X& X
! ?9 w: H; y+ W) q! [
}
& N6 _; d7 U1 _3 c) selse if (document.layers){# [- A" r" D9 p! ~5 w0 Y
if (ns_marquee.left>(actualwidth*(-1)+8))$ X# F$ f8 v% D" y( ?5 {+ \
ns_marquee.left-=copyspeed
) R6 x. o, @$ [- S( Helse9 g0 _1 V; q$ D) K
ns_marquee.left=marqueewidth+8
' T3 F. f4 L; U! T}
+ B' Z: v4 _7 z+ v}* }2 `# Y' K2 u2 F

+ Q( V, K# e, U" f# b+ N7 r/ cif (iedom||document.layers){
/ t5 z1 v) b0 K8 d/ _  [with (document){
5 M. ]# @0 p, V$ d) x" f) Kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" P2 B8 `9 Q5 k2 c
if (iedom){
2 o% t' e) r. ]2 l2 c' Y0 b# kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) \+ u$ F' y- j
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; ]+ q% H; j! @0 v0 }  Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 F* b9 X2 j* H% `1 f' t4 Z. Pwrite('</div>')
; q" z" d$ S& X( z9 ~, ~( S) ?) P" q0 U}/ U+ t$ s* k! ^1 J" d
else if (document.layers){
- Z! D% x/ }1 B/ f. Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; W* Y4 Q& y# Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). E* ]0 w7 R( H. q
write('</ilayer>')0 R- e& t+ M( T- x7 O) _
}# l- f# W4 E) N% H" o
document.write('</td></table>')3 ]3 ]/ y, J* P$ y% O2 g' O
}
/ q3 E7 r9 p) ]$ C4 s0 v' A" X}
" m. x4 x$ J: j& V0 o7 ^6 P- B</script>

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