返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ }# C" ^% y% {# Gvar marqueewidth=300
6 e# [4 x. r+ T) K8 h3 G( _9 z//高度3 g, C% N, s: q( d; Y1 D' I
var marqueeheight=25
3 J+ ^/ d" m5 j: C& w//速度(1-10)
, d3 T  d4 z* P5 ?! hvar marqueespeed=3' z, d. [7 ]+ u% L! `9 W
//背景颜色
8 H' [# u1 }: ~( ovar marqueebgcolor="#FFFFFF"
4 `1 ?" E# r, M( N$ ]" ], E//是否能暂停 (0=no. 1=yes)?/ K- X# S" Z1 f3 w( l, @
var pauseit=1
& z! s4 ~: ?$ _! b8 _3 J+ G) q2 k+ ^0 o' m. w1 {' y+ M! }2 I
//修改显示内容' V" B  ^9 b6 J* G, H* {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* P+ ^% J3 G; r5 x# z, A

( i9 ]$ s8 ]9 W8 B" q9 z7 o/ s/ [0 |  O. Z# B
////下面不需改变////////////
  q. N; D! Q- J: E1 _& O
! Y3 O1 j. j& @. c( y, z" Gvar copyspeed=marqueespeed7 V$ Y; O1 k. c7 i* J5 e- m& R" P
var pausespeed=(pauseit==0)? copyspeed: 0
6 D- P1 q; P: Z- d$ Gvar iedom=document.all||document.getElementById
/ Q$ G: ]7 G9 w1 `, q4 q" M! U- }if (iedom)
  ?. O  L$ T- [% i1 d" y6 ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! S. |* @0 Y8 ?  J  c
var actualwidth=''
% o, U  w) l4 l/ Nvar cross_marquee, ns_marquee6 ?, Z/ t+ n' s( p( L. k) G
% |0 w0 N4 ?0 u: t
function populate(){
6 v& }1 Q8 I8 I8 o2 H& Iif (iedom){
+ r  F( I' Q3 i2 d: xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" U& \; a* I6 Y6 T: S4 t. X
cross_marquee.style.left=marqueewidth+8
0 {6 b. |' Z' a2 Zcross_marquee.innerHTML=marqueecontent
/ E8 D3 ]% r# B/ eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 B5 L" l- m; D) U' s1 v1 a0 v& P}4 W, F" ^5 i+ g7 E2 z+ W
else if (document.layers){+ }- |# G/ K- ^: X! ^
ns_marquee=document.ns_marquee.document.ns_marquee2% U# N5 e% R& D5 [- h6 D7 k. o
ns_marquee.left=marqueewidth+8
! |+ `$ G' K  c& nns_marquee.document.write(marqueecontent)4 a$ x  ]; r9 c8 H% U- V% y% T
ns_marquee.document.close()6 K0 {* W0 Z) P" |4 u: y& }4 P  W) C
actualwidth=ns_marquee.document.width
+ Y8 C: V: v: R% b$ Y) a7 w}1 ]  L5 X* }6 Y% F( w) y0 Q
lefttime=setInterval("scrollmarquee()",20). i/ p$ z5 F, L' U$ J( N: Z
}
4 v9 l* J) u6 q5 Y8 jwindow.onload=populate% e: Q  ^) ^) z1 G
/ v0 A" v: A8 d; l6 H# Y/ z* q9 k
function scrollmarquee(){
0 u0 s2 V' |; K8 K% ?- Z! @if (iedom){  P3 x  r6 n/ n7 Q7 E( J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 Q% Y% \- z9 Y4 zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( T+ `; R' A' a2 t! K7 E+ x
else4 Z8 q( g$ q1 b6 ~0 m/ D: w
cross_marquee.style.left=marqueewidth+8
8 V5 G2 B( B2 ]" C$ c& d5 j( X. U/ {* O. N
}
( d9 J+ E# F, Y! s, {& L4 {9 Lelse if (document.layers){
) P0 M' g: n7 Bif (ns_marquee.left>(actualwidth*(-1)+8))8 g  n3 Q% O4 N' W( F
ns_marquee.left-=copyspeed
* u% ]1 i; b; {+ H5 helse
7 T! k5 I; ]9 s- e9 `7 e7 Y0 Kns_marquee.left=marqueewidth+83 P2 o2 m2 d! ?& z4 Y
}
- [4 {8 g8 ^0 ~6 r, B4 g6 t; F}
) ]3 N' U0 S, G+ n9 Q: u: y% q. e7 e! C, ^9 B% }3 y% L# ~
if (iedom||document.layers){
+ V7 l: v3 r5 _8 J+ Mwith (document){. r1 R! ~3 t, B5 W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 h* d: }$ k6 V) n6 Fif (iedom){
+ Y0 x! A# W* W# mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! w( ~  ~, i/ J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# b- t4 c+ ~0 x( K8 mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ g3 ]% z; Q' B* E7 B2 B2 }
write('</div>')
, e0 H" |: Q  A9 r6 l. u. g}
. G# M/ [' Q' yelse if (document.layers){
/ F  _2 ~, [! @- u1 \) B, wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 t( D% U# B6 b" g; rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 a6 A* o7 {: W5 N  R. ^
write('</ilayer>')
) z, S4 c" e" C2 L) V9 N}
0 V& F& b9 ], M/ jdocument.write('</td></table>')2 h& q1 _* Y$ d% a6 R
}
  v. ]2 l3 x. ^' I! d8 r}
9 D" u& z- T9 X6 j; `8 i& b9 m7 j8 o</script>

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