返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 R4 @- H3 p# y. _+ \7 r; Pvar marqueewidth=300
; i& M0 R. z8 U7 s$ g! P( r- W//高度6 M& B8 z1 K- G8 C
var marqueeheight=25
5 A; V4 a+ {/ L% \2 F4 g; u7 ~( |//速度(1-10)9 j/ U5 S0 J( C+ B7 X: u) D( P
var marqueespeed=38 a8 {# y$ ]9 f2 w" c
//背景颜色8 W2 O/ ~( K+ \- I; C& Z% P
var marqueebgcolor="#FFFFFF"
  o& o3 ?: s- c% M//是否能暂停 (0=no. 1=yes)?
# z& J7 A$ ~- h/ m3 zvar pauseit=1
& y" Z* W/ _! z+ ?4 e: l
& T1 M9 {5 g4 K0 G' K, o+ e//修改显示内容6 y/ ?+ D5 p% g: q! u' |6 ]: N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 \# v* |+ Y. U
, r' f) M1 ]; B
4 [  E4 g3 J# z" f////下面不需改变////////////
# S8 P$ k, \$ s. f/ S9 q8 W1 B" s0 f4 X6 S4 ~' p6 {
var copyspeed=marqueespeed
, K, ~- Z1 }1 Z$ z4 Wvar pausespeed=(pauseit==0)? copyspeed: 0/ E. x( j( o' ]7 E6 H8 O
var iedom=document.all||document.getElementById: B5 H' }% u$ \$ q  L' R) {0 d1 m7 s
if (iedom): i. a" C+ p- i# b6 v: H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 F- y/ ?' s7 E/ u; Ovar actualwidth=''
% b# i1 [6 d* nvar cross_marquee, ns_marquee
  \5 P* ?% ^: e6 T4 o+ b! }% ^7 T- H( Z+ U; X
function populate(){
- _7 a: l  w+ ?+ gif (iedom){
7 ?" q% C/ L5 r; H- Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% o$ |' j: @: Z+ s4 V
cross_marquee.style.left=marqueewidth+8
& s5 z9 `% ~/ t' Xcross_marquee.innerHTML=marqueecontent
9 a6 X7 [+ e% \0 I' o; A+ kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- F0 V  x$ [# n}
) Q5 l* @7 K* `; P3 aelse if (document.layers){! P9 a7 _% \* N
ns_marquee=document.ns_marquee.document.ns_marquee2  [. w" b' x1 \3 h. n3 N  e
ns_marquee.left=marqueewidth+8
$ j4 [& g2 ?: J# K8 Vns_marquee.document.write(marqueecontent)
1 X, @. D! z/ O% q4 v: ?4 ^8 v7 mns_marquee.document.close()
4 q* `5 O- P9 Q# t/ {actualwidth=ns_marquee.document.width
( v1 Z3 ~2 M1 e}  i! u+ q8 @5 J& G! R; T3 [
lefttime=setInterval("scrollmarquee()",20)) b" D$ _( P, F' S& E1 w
}
: R6 l3 I( [9 p2 ~& [window.onload=populate& `9 R5 Z5 A, x7 A) B

- _' A& [. v/ X. cfunction scrollmarquee(){4 h6 {: D# a; M, }6 r% d) S
if (iedom){" `$ \$ m8 B" g# M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 q9 r2 G' n+ C. L, Y8 V3 Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 k+ U- v0 ?; E3 O  W+ G0 \9 n
else
9 P( W6 U5 x8 qcross_marquee.style.left=marqueewidth+8
- a& E8 j3 Z+ p1 B7 \# |6 J
, m: |) U" f7 y- u}
+ x  g+ ^+ a" [! g% e$ y+ aelse if (document.layers){
1 K, X2 C3 L3 F$ @if (ns_marquee.left>(actualwidth*(-1)+8))3 `4 O- w1 }' P: {0 X
ns_marquee.left-=copyspeed# l) X: W# j- e8 v9 X. t
else: p) {$ I# A8 m* N% j5 a3 g
ns_marquee.left=marqueewidth+8
5 b2 H+ w2 E6 d' N& ]}
6 E! y5 C$ {2 o5 o$ X}2 c4 M- A4 l: C1 w

6 j9 d% s. K, B. N3 Y- Tif (iedom||document.layers){8 C! A1 v/ _1 e' U# U6 q
with (document){
" P6 R2 s2 y  l# V0 U! I) qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( A5 ]- J# U: ~6 ~0 m1 Cif (iedom){0 _$ \5 P/ l" N7 }9 V8 m( H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! P8 m6 i7 \& B" t- z8 I+ w, kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* Y* I% j5 N2 l* J: ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! ~) }+ G  K: H
write('</div>')+ d% Z9 U% U- A# n
}
1 W) ?6 @( s; \% `. \: S1 @else if (document.layers){) x- n' z2 D* r0 E1 q& l: h; Y; y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 w" N& M1 u0 p8 r1 e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 f: O7 x# \2 C& ?
write('</ilayer>')
- ?& _3 C6 a# n}
) ]- M) M9 n4 z0 w. Kdocument.write('</td></table>')
9 o* X, V. _- c9 g$ P2 A}9 B6 P' k' O% N
}0 c3 @- c* b! J" B
</script>

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