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

|
网页之跑马灯文字特效
//修改宽度
. p( x7 R5 [; R4 X! pvar marqueewidth=300
5 W3 w5 M& n7 z5 {5 I3 _2 s//高度% _) R6 S0 S: [3 B/ W G3 v& Y
var marqueeheight=25
6 ^' s2 ?* Y! s$ e9 s' p4 A- |//速度(1-10)
1 z2 [# w3 v* N- W- i6 hvar marqueespeed=3" t1 R9 }; k/ m3 C. t, a
//背景颜色
! z* J' w, ^, U+ ]var marqueebgcolor="#FFFFFF"
: N2 H7 [. S% _, K0 J- {//是否能暂停 (0=no. 1=yes)?, l# ^0 f6 P7 f' R& P) h1 f
var pauseit=18 r: A9 t1 X% O* _1 {2 I. |3 m4 G0 b6 y
. ]5 g8 S5 v/ s( A! g, y* a0 E//修改显示内容
0 K8 l4 d7 ]6 n! c d" ~* ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 R1 g4 y4 I* J; m6 N4 _$ @/ b
7 t! L' ^4 p \8 K# I% a z
* D& {. c+ H, l; R- o+ H////下面不需改变////////////
% _( l7 {) o5 ^$ R* k) T
3 \8 j8 u8 B! b- }var copyspeed=marqueespeed" a( o4 g( p/ H' [
var pausespeed=(pauseit==0)? copyspeed: 0( N% l7 W- r! i3 W5 g$ w
var iedom=document.all||document.getElementById& _& {2 g( S( |2 z B
if (iedom)
$ ~( {' H. g" i- ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
F$ d/ m2 c$ H( J. Ovar actualwidth=''
9 |* t" D+ t( ~' h. ^) Y2 Evar cross_marquee, ns_marquee
2 T: [5 B3 g' g) {6 o8 I; j# \3 |3 v' T& h% C ]( Q: J
function populate(){
* m4 P( A6 _) S6 @- O/ wif (iedom){' f% \; j* U1 ~$ T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# z4 t/ D' O# v/ v8 e, [% Jcross_marquee.style.left=marqueewidth+8% x! X8 Z2 z% x8 A: R* d' u: m
cross_marquee.innerHTML=marqueecontent3 H# k( F( A% M1 @5 e. h3 t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 m# C/ h: C. T7 z+ k}3 c. M& K8 y( f7 a& ^& d
else if (document.layers){: d% X5 S, C' A9 ]0 k
ns_marquee=document.ns_marquee.document.ns_marquee2, \, C( F; q7 i8 ?9 C+ P
ns_marquee.left=marqueewidth+8: ^( b7 i1 z4 j, h
ns_marquee.document.write(marqueecontent)! n/ k, |, M$ o% z" v2 K6 }( B
ns_marquee.document.close()
( ~& p. ^* Z! x1 nactualwidth=ns_marquee.document.width
( F6 J' |7 [4 `) t" N}
' n$ N8 `) H( g0 o6 V# blefttime=setInterval("scrollmarquee()",20)
. M( ^+ i+ `' L$ e}
. e8 F, @2 S1 k3 Ywindow.onload=populate
% w1 U" f& x! x8 z7 m- g: b5 P
3 I9 h( ]9 v8 _9 \0 f6 `" R" jfunction scrollmarquee(){2 H! C' [; S& G
if (iedom){ G) W5 w* w/ k& w* E4 x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, A: f: U/ P" gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! b8 ]# E1 o' m8 V8 X& n N7 relse
$ Q" `! v* X# X! f2 G _cross_marquee.style.left=marqueewidth+81 z3 D' d' C. z2 Q% G
3 F; R& N! E5 b6 J/ b, ?}2 |$ q9 d) d4 [" c" g; t
else if (document.layers){( j3 ]5 K& J( \( f' F* X
if (ns_marquee.left>(actualwidth*(-1)+8))$ Q1 O" C/ X- f. B' a" y6 g+ N9 x/ f
ns_marquee.left-=copyspeed3 N/ v; o1 H# h
else6 o# O1 ^8 {, D8 o+ j1 J( s, B
ns_marquee.left=marqueewidth+8
3 O6 e. ?, e5 w% w% D+ n$ n( t# R! W/ q}3 o0 o7 k6 ~- p9 q& _! c0 p
}
2 B8 W1 E( c! u$ o2 H$ |( T! D! _3 y$ P& @! g3 \/ k4 u g/ g
if (iedom||document.layers){
/ ~, g/ U3 @# |& N+ G; B; ^with (document){% ^2 P5 a: C5 P4 E8 @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 x, X' D9 d9 N5 ?- D
if (iedom){* a$ j N9 `9 x' w1 i' R6 J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& y2 \; j2 B/ M t3 Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 [) D' f: q M0 B8 Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% b2 ^9 W! w. O# q
write('</div>')
" U2 ]3 b5 D" N; ^( c3 a' }1 U" i}: L9 A o* a. [. ~# x( X
else if (document.layers){
+ m& c, [ g6 l( C. ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); `/ Z' _3 z# G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) w0 f- C' g/ N9 |$ C
write('</ilayer>')
$ j1 u j1 ?6 I. s: I}" r9 D3 E3 ~/ E) } r
document.write('</td></table>')) H+ k' }/ \+ g9 F& n* G( r
}
0 U8 K& ^- ?1 X5 j% e/ c6 h _1 k}
" C5 U. b$ H8 d4 I</script> |
|