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

|
网页之跑马灯文字特效
//修改宽度
7 i6 z+ k/ P0 s/ f* Ovar marqueewidth=300
. z+ m0 {, _8 I/ n1 c4 j' i& C//高度
# t, `' |; @7 S7 ^- j# W2 ?var marqueeheight=25+ v, v$ W& C) A( z/ e7 N3 D2 I% n
//速度(1-10)
' f, q( o' D% X6 d7 Fvar marqueespeed=3/ I, r8 l9 l/ D* C; Y6 q9 Q
//背景颜色1 V V; m9 Y4 {$ Z: A7 t1 e) C
var marqueebgcolor="#FFFFFF"
- e" |: ^1 K" C! C) R5 ^4 h+ @6 d; V//是否能暂停 (0=no. 1=yes)?
) V5 z" R9 v/ g0 D/ Wvar pauseit=1. S1 }6 n2 t* \5 B: X t
& L1 M3 B! J& U; E//修改显示内容
; {+ z/ q# q& L' T" Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', G) q0 J" A2 y$ d" l$ z5 P
7 M' M0 D0 O& C4 F
0 p7 E$ d. n2 b: Y; S////下面不需改变////////////" \( ?! ~5 S" Q( E/ f' j
5 j' G7 n4 I5 j# Ovar copyspeed=marqueespeed
: ~! | S! S8 V8 Q/ y! X( S, Bvar pausespeed=(pauseit==0)? copyspeed: 0
4 }8 w- i$ m- [1 T% S; r- avar iedom=document.all||document.getElementById$ j/ @: Z7 C( N9 q) V
if (iedom)
! |" i5 h, V# R4 ?9 {2 R& @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 {' w* O" h4 d Vvar actualwidth=''. T7 ]8 P4 o' Z& h% f; \
var cross_marquee, ns_marquee. r s; t5 w! P& ^) W: A
/ h1 F! s* J afunction populate(){
3 K- Q7 } `( S* X7 w5 }if (iedom){$ `7 _% ~$ R, w6 O- T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' E) w$ s) M# |4 W) v5 qcross_marquee.style.left=marqueewidth+8
9 n! [/ C9 r9 J: _! A h5 i7 Ccross_marquee.innerHTML=marqueecontent4 X' T* U: [6 `+ @9 A) L% c- E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. u v( S5 w/ N4 g' P2 f, y* z7 n3 X
}% ?( ^9 Y9 d; K$ ^& G/ ?2 d
else if (document.layers){6 S9 S4 @+ X+ R/ y6 h! b
ns_marquee=document.ns_marquee.document.ns_marquee2$ f5 y. }! I; C, Y* Z# \* `& O
ns_marquee.left=marqueewidth+8
: G: `4 e' L% W0 ]$ Gns_marquee.document.write(marqueecontent)% O! t. u) J' S5 W+ i; a
ns_marquee.document.close()& s* l6 B: c }# C5 V+ _! w
actualwidth=ns_marquee.document.width# [9 \4 c" x8 O( W# R
}3 M. T) p& i% M9 f. d
lefttime=setInterval("scrollmarquee()",20)" F4 P4 ?5 ^& \, k* U
}
- H t. ]4 J7 p; S: @9 |% G0 v/ y4 |window.onload=populate# Z6 w) I3 \) z6 G/ T7 y
% c0 K W; S& L& c
function scrollmarquee(){" P, ?) B, x. d t! [2 d- D
if (iedom){3 [- h5 K4 Z* a* t _1 T+ ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% n/ }8 a p" |& k l8 w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' D4 q" d+ Z+ @4 y5 Pelse
& Y l( L" v, Q# h% a. {cross_marquee.style.left=marqueewidth+8
1 F! s! U( ^; c; L2 {, i; Y# h1 D
0 f* }2 Y# r/ O5 X}/ W; g; x( N k, _- R t
else if (document.layers){
4 T) _: R X S2 F6 L( \if (ns_marquee.left>(actualwidth*(-1)+8))
" E4 q2 P5 G8 {' K3 fns_marquee.left-=copyspeed
; D7 Q/ d2 e9 qelse
3 s/ C" `" {" J6 n8 S4 gns_marquee.left=marqueewidth+8& F( W! Y/ u/ a9 l5 q! K
}
9 K& }2 {' @; ?4 w" z3 ] |6 e* h! J}3 b. M d/ J+ j" O4 e& u
% I6 _, B. E* M. @4 A' d2 mif (iedom||document.layers){
0 N. q( Y+ p7 Y* w0 f- P% nwith (document){, c. f* U, o+ ^. B! w. ?9 }- E) x/ E
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% K8 L" p/ N, ?7 R4 e: X( X# l" X4 R
if (iedom){. ^! ]9 P2 D9 `) D9 m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ K& a6 Z' o# a, ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ G h' h, ]* l% w m$ a* m$ lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 ?( |; w8 m6 n1 Q
write('</div>')
! n# f& ?2 b- B7 D; D}( H4 |: T! ~( U+ @& K r. u# O
else if (document.layers){
6 Q$ Y3 h2 F& E1 zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 {- O, u8 F' |, h$ ^3 U: Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 \% {- q- Q$ |, i: C- q, \write('</ilayer>')
/ G' @3 [ D7 Z1 f" O: o5 [}/ F4 ?& E% d$ f* \) t3 ~/ m
document.write('</td></table>')
! i! B' d7 T, e" x' a}
% T- k! J; X$ d0 S+ t) o; T}
5 V9 }1 g! T+ Z, P S</script> |
|