|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度9 U; U! L8 ]' m3 t2 @5 y
var marqueewidth=300
! o9 T4 b0 C0 ~ Y) P//高度
; i8 E/ \- A! ]( H4 j% P( ]' vvar marqueeheight=25
" u2 I9 }- a4 O) v7 _//速度(1-10)! C& r* F- _1 |+ x/ e
var marqueespeed=3
; S! S t% ?/ }/ B, [//背景颜色
2 Z- c+ K2 ~" [- v. q' svar marqueebgcolor="#FFFFFF"3 D5 w+ z% H% i# [) v5 C9 a
//是否能暂停 (0=no. 1=yes)?' g' v! ~! H2 u( s% d6 ^9 t
var pauseit=1
8 o0 r$ a2 G7 v% b$ O' {% N. i1 k! T' q
; i3 I Q% U/ J* W# n//修改显示内容9 ]% z7 Z6 B9 j2 }6 l2 c) u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ d: v; ?# S2 A7 \7 X/ n
* N) j7 i0 c% N& f- R5 s2 x
( _6 J* Z) _( K2 `8 R) I' |////下面不需改变////////////
, |+ B5 [6 T6 v6 y$ U- I/ m/ n' ~3 e5 S, `6 k7 L% k
var copyspeed=marqueespeed
" e/ B& F8 U# n( D( W# W! `var pausespeed=(pauseit==0)? copyspeed: 0& q: B: M- P) Z5 o5 {, ?9 _$ k
var iedom=document.all||document.getElementById$ ?* F( e4 \& @) x3 l
if (iedom)8 ~8 q' F4 w# M/ i( C, n w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 p' D5 x; G* M# m5 b+ v# t
var actualwidth=''
3 z) a$ N" u" q9 Q! N% hvar cross_marquee, ns_marquee
- S/ k" X8 ]+ g3 k1 B$ u+ Z
4 b4 u1 i3 N6 D/ v8 f" ` r( [function populate(){( U7 u) O& }8 D5 z
if (iedom){
: x4 H3 G4 D% icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee o6 E- A# c; X
cross_marquee.style.left=marqueewidth+80 K/ H, j; @0 y4 g
cross_marquee.innerHTML=marqueecontent1 ~1 B" V( p [; t% G4 o8 B5 q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' R! {. Y! e/ E7 A/ a" ~}: b: [# C. ^4 N
else if (document.layers){
& L/ i! l9 u9 \; ins_marquee=document.ns_marquee.document.ns_marquee2
8 Y, y; i* S1 {+ k9 v3 Jns_marquee.left=marqueewidth+8
" f+ j" i! w& g6 m/ V! Q1 |( c0 }ns_marquee.document.write(marqueecontent)
; b8 A& m& C3 B. e5 g+ kns_marquee.document.close()3 n' T5 B8 P' u0 x9 U5 i4 m
actualwidth=ns_marquee.document.width3 W" W' T- D8 p3 p
}& _& c {. a8 n' J" a# {: t
lefttime=setInterval("scrollmarquee()",20)
' _% e5 Z) O' ?5 L! }7 t}
. L, \2 o ?- A- n/ {window.onload=populate
+ z1 n$ k, z. {' d' R: m0 C; S! H2 n0 ?+ K
function scrollmarquee(){1 X1 n( a0 m* T% [+ \5 e. {; L. L: S3 b
if (iedom){
- b& E9 ^# _ B! [( Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ L: a! ]& r$ z8 u, Y0 p' ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 z' X g" m" x4 p, d1 s9 a3 Pelse' z8 n( g, ]5 l- e# f# f
cross_marquee.style.left=marqueewidth+8' L* p4 g3 r% l2 Z
& n! ^# s9 g2 v# f# J6 u$ A" N
}3 v. [/ M2 C) R" {& k
else if (document.layers){3 S& R+ w8 N( y- Z: o( \& x( \, P
if (ns_marquee.left>(actualwidth*(-1)+8))
* n. v1 o- E, Q, ?( p6 xns_marquee.left-=copyspeed
7 y6 q4 X4 A" R- d0 K7 `+ }! selse
% ? O' ?. z' ~- `ns_marquee.left=marqueewidth+8
4 A; {" }4 a8 A}
$ j/ p$ Q" k2 O}+ ~. G& W' n$ z
! a# b6 f. T M; o; Z& M
if (iedom||document.layers){1 \4 m$ M* h: O7 r4 }( _
with (document){2 p* w# R1 ]& ]; |6 a8 M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ [# P; ^" g- G I$ u! q E
if (iedom){( |! a7 H& [% R9 C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ V' Y/ J6 k& Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ y- b8 J4 y+ U4 w; `) Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- q5 c' B+ I! z. e$ l
write('</div>')
6 K) N$ F; J- L7 Q/ [; n5 q. K; g$ |}$ y3 u5 {& c* F/ b; a! H* _
else if (document.layers){
, ?! x5 p9 O* P$ ?/ I# ?! g7 y4 rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( G0 u3 V( A3 O, u& S2 K) O+ O) r7 ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% j. s- J6 i) y. V
write('</ilayer>')
: ^' I+ ?: |' z2 e3 E# T% k}
) e; B: Q; t- r. l ddocument.write('</td></table>')' I5 g/ j0 }# N0 f+ t3 x
}
8 X: }* ?2 U; C}
) q c- ~$ M# ~2 a- Z m+ ^</script> |
|