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

|
网页之跑马灯文字特效
//修改宽度# x5 s5 R h- T. A+ [ d/ V
var marqueewidth=3005 x$ J5 g1 N2 P/ J/ S9 P
//高度
! v' [1 M- C9 J' F% ]$ S7 nvar marqueeheight=25
5 s, v! F8 ?3 y//速度(1-10)
6 u/ ?8 _0 v- T( evar marqueespeed=30 L+ }+ h0 A- j7 W/ B' n \
//背景颜色
/ {& Q. M0 G" c% `9 |$ N- {; Dvar marqueebgcolor="#FFFFFF") T& P' c4 v/ Z: [5 B" f3 y. ~9 r# o
//是否能暂停 (0=no. 1=yes)?
! O9 u7 n% K- B9 {1 Vvar pauseit=10 q+ R. U* M" q
0 D0 e8 | g) l' w) J8 ]1 s
//修改显示内容$ y5 Q# R7 `7 \0 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 c! e" ^: U8 M+ D$ L8 G
2 {0 a1 u* y: G$ N0 g( _! e% L$ N* \# B- f& V/ a
////下面不需改变////////////; L6 @' e4 U+ p4 h4 h
: O' J& K+ k% h7 Z6 P
var copyspeed=marqueespeed
# W% F4 m) s0 A1 z1 q# p) \7 u9 V7 S Jvar pausespeed=(pauseit==0)? copyspeed: 0% b& \7 ^! L% c2 U( h C2 H( T* ]
var iedom=document.all||document.getElementById& E+ Z/ t, o; ?; g" C- k7 b. _
if (iedom) I5 e: S. i. U+ w6 g0 D4 P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. A& Y$ L% ?9 u; d$ mvar actualwidth=''
7 m- ?/ E7 u1 @) ]. svar cross_marquee, ns_marquee( `9 U, P( f$ D) l9 ?9 M9 T% P
6 m, u- F0 M- y# q$ K! Gfunction populate(){
# j5 Q! [9 ?$ ]# j" b1 g+ J! zif (iedom){4 `5 R. Y5 G' H/ O4 Y8 ]% z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 S' d8 u) Q7 ^) scross_marquee.style.left=marqueewidth+84 p4 E( f/ v8 I' I9 {( s4 U* E
cross_marquee.innerHTML=marqueecontent
( I: W e- `. b1 F" K: o1 Z$ Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) {! L# ]! i' D6 W; j
}
* m* g: f' \: {6 f3 e Aelse if (document.layers){
- b0 [$ Z% @8 t% r! v6 C7 J2 o% Ins_marquee=document.ns_marquee.document.ns_marquee22 V$ N9 W( c3 }" ]; a) C
ns_marquee.left=marqueewidth+81 H' [; O; x# C# F, s
ns_marquee.document.write(marqueecontent)5 I# X h, a' I" c
ns_marquee.document.close()6 N/ A6 p4 ~; m6 M
actualwidth=ns_marquee.document.width
. F( d+ b! T& y: I5 m5 _}6 |' x/ g9 U# m9 f k9 L
lefttime=setInterval("scrollmarquee()",20)
4 N3 M2 a/ T- v! |: q& G: S}
. F- \& X7 e- ]& j7 y9 A$ lwindow.onload=populate
' Q7 x, G) D4 D5 b6 T( L
2 P$ U0 h/ |9 N" F9 F' ]function scrollmarquee(){
( A' \: X+ Y4 H5 nif (iedom){
! c7 L E2 K# @6 N8 h' K6 vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- C6 _9 a! K4 h$ u* f( K: s0 m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& d* I+ s) S# T6 v/ A4 w
else# K( L& ]5 I( `
cross_marquee.style.left=marqueewidth+8+ d5 \8 K+ D5 H: _
: H: n9 u7 H# [9 d2 k8 D8 N}5 p6 z$ A4 I7 ]. o0 y6 s1 t& X. e
else if (document.layers){
' I+ T6 n+ S2 S& A! C- Oif (ns_marquee.left>(actualwidth*(-1)+8))
6 G ~! N9 O) v7 q6 o( _2 ~ns_marquee.left-=copyspeed- `% j0 w+ F0 D
else
' a1 b o9 K+ Fns_marquee.left=marqueewidth+8
- |9 D. S% t+ g% v, o$ F}' R3 A; ]- u; i* }/ F6 X1 A2 `( ^
}
% {, K7 W9 ^0 q$ S/ J
" ]; j! l! Q+ Lif (iedom||document.layers){
7 w# Y' a+ ?* ]0 H+ C( m! ` r5 ]with (document){
, M9 ?- P; Y! C; Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 p, Q( s# p$ m( l) gif (iedom){* ]5 D2 A& ]" |/ b* d) B7 o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 P4 {: M+ e9 h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ S& u# a% `: N, Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* F6 B* |! ^- A; N1 f' u
write('</div>')
3 b0 D$ H+ I) U5 i; X. O- Z& n}2 P, I8 w$ c; K" F
else if (document.layers){+ b0 f/ \+ ^9 m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* H3 ?/ E4 }+ R+ F6 r2 Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. w6 H" o+ z6 B) T; ~5 Swrite('</ilayer>')2 c2 S6 E1 o0 b6 D& j, M3 z; u
}' J! u6 Z9 x! A
document.write('</td></table>')0 B' y2 x2 U( S1 e; A
}
8 z1 }4 L& I6 M+ Y}
% X$ t5 w; s' } z8 @8 J! W9 T</script> |
|