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

|
网页之跑马灯文字特效
//修改宽度9 f1 d/ x+ Y% D) M [$ }
var marqueewidth=300
% e, Z% l. J- q! z3 d//高度( X7 z$ O7 k, u9 m
var marqueeheight=25# t; G, ~! [. h4 Z% R, K9 j. J: u
//速度(1-10)6 w9 i6 i# E0 H2 B. }* e3 a
var marqueespeed=3
0 f9 S3 W8 @: x! V8 g//背景颜色
9 t" T' X. \3 G* M! b3 Z* a) qvar marqueebgcolor="#FFFFFF"8 H/ q; P7 m; u5 c3 }
//是否能暂停 (0=no. 1=yes)?
; R; t& s- W# _( ]var pauseit=1
0 l, Q1 p/ K" L+ E
6 u$ B) k) X: P/ A: ~//修改显示内容
9 e/ J) p# h$ A1 t5 i& w2 Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': y/ ?) y; {1 f2 k, P! L
& K! l: q( ~/ v s4 @. z3 C5 T/ C3 O9 h8 X7 s
////下面不需改变////////////5 d5 t/ h3 r# ^! `. o
& X( w5 P3 x1 Q) @: o1 Evar copyspeed=marqueespeed3 N$ J Q: H0 I6 f, l V0 t
var pausespeed=(pauseit==0)? copyspeed: 0
9 O! a7 e: f7 Lvar iedom=document.all||document.getElementById0 m2 I: O, D$ h& m" O4 ]
if (iedom)
4 g4 H3 H& [ ^% c- ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') c* M- z# Z [0 j- n) l
var actualwidth=''
+ o5 ]+ _$ c$ Y6 m6 @, Yvar cross_marquee, ns_marquee
* z0 Z& f/ K6 g3 ^ w* G4 p; _5 o$ H0 S+ X8 d
function populate(){; k" G6 q9 V3 Z9 s: |3 j9 M
if (iedom){. D1 R8 r7 p i9 s7 F" C9 J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& W, a) t) `2 Z. gcross_marquee.style.left=marqueewidth+8
& y; g P% H' o* ^& s/ scross_marquee.innerHTML=marqueecontent# b p+ ?* T6 h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 G( E1 [! N7 C1 Q1 ^5 r}
- i- t# m6 i/ M; j5 |' Jelse if (document.layers){
! u5 v7 E* o4 c7 z; ~0 Mns_marquee=document.ns_marquee.document.ns_marquee2+ w' n$ i. W7 O/ p7 t* X
ns_marquee.left=marqueewidth+83 u5 {4 D& ?" i4 U5 {3 |' F) f/ q
ns_marquee.document.write(marqueecontent)
" f3 A) D; x A9 Ons_marquee.document.close()
# C* c* s, P z- @* ?1 eactualwidth=ns_marquee.document.width
1 F g* M& t! z0 r}9 i& n9 q2 V( o* P2 ^
lefttime=setInterval("scrollmarquee()",20)
8 A: P& ?& e2 `. H2 I}
6 I6 `% B# z, P8 r( f) N7 @+ @window.onload=populate+ \6 R* ?. O' a
# r( G. L$ J O; F" |" F E' Hfunction scrollmarquee(){
( u, d' o5 m* R, P0 i2 J3 }if (iedom){
. \+ Z5 Q! R) m" Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 c) B7 j7 r$ q/ ~5 S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 |7 h1 ]0 d2 E! f0 nelse" h- P. p3 I* |& @1 l: H, u% r. d1 f, y- f
cross_marquee.style.left=marqueewidth+8
5 _ W' a: ^. e" f6 C0 r; e# C
$ O8 c- Y$ j7 b* @) r# v' Z5 X}6 Z$ G; ^& b2 A/ \
else if (document.layers){
0 t4 `" U$ j) |8 Z2 P( xif (ns_marquee.left>(actualwidth*(-1)+8))
' l! j# @% o4 {! h8 @4 w( E5 Zns_marquee.left-=copyspeed t7 g7 h/ l8 @- ~6 B1 f( E
else6 q" R/ V+ K7 x; q
ns_marquee.left=marqueewidth+8
# G! h6 e7 t5 @* z% h2 s}. m. o" i% M$ X# K" b8 T
}2 l/ \% c9 f3 D* V; t
2 T1 k! V) H: oif (iedom||document.layers){4 k1 J: V9 `: F2 M3 \6 D: W' y* u; P
with (document){+ V( d0 J/ l+ c: M3 @. v5 S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 z& @. \& x% q6 I. f7 U) I
if (iedom){# {. S2 }# x# ^% a: k4 ]7 x9 {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 d3 [% l/ e" O1 |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 Q+ F8 k4 O9 hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') R9 a% b4 ]( M2 t5 O( S
write('</div>') d' x' _+ z# S r: C
}
( {3 F4 K5 R! w) @3 lelse if (document.layers){8 z( C9 x) o/ j) U+ f0 g' @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ ]$ ?2 D* t e8 y( a. c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 V8 z- \( N7 [write('</ilayer>')
N: W i4 S8 P# _/ `8 _6 o}
x- C4 Z# g% @% adocument.write('</td></table>')( J; m% m/ z# v# t! J& O% ], [
}9 a: d5 F" E5 ^: l1 j- R! z$ [, I
}/ z+ M9 @$ a6 S4 c! n! K/ o
</script> |
|