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

|
网页之跑马灯文字特效
//修改宽度
* o; ~- s; H2 M8 ^. P9 `; hvar marqueewidth=3006 O+ z3 M! K9 M3 Y+ Y; C
//高度2 w% q# U4 H! o" C" J; r9 b2 |: J$ d/ v
var marqueeheight=25
* R/ _0 Y1 E. X* ]6 b//速度(1-10) Y) r7 W: U( l2 N5 T: G
var marqueespeed=3
/ n u" K1 A- x//背景颜色+ B) x; W+ x, ^0 X+ g0 N
var marqueebgcolor="#FFFFFF"- K+ @6 \% r" d/ F
//是否能暂停 (0=no. 1=yes)?
) f% a. p3 B7 zvar pauseit=1$ a+ b+ G1 q1 n1 h% ^
+ L. a% A( B4 @+ g! W) L( g1 Q G, I. u//修改显示内容0 w. K$ g& h; X0 V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 X9 r/ `0 }/ T4 u
, i. l2 ~ r, X- f2 B( Q k2 c. Z2 P% G- } [8 |% C' e
////下面不需改变////////////
! h/ p7 O5 f$ d0 V0 z1 \5 f" Q( a' j
var copyspeed=marqueespeed
1 |; P. s- l9 ovar pausespeed=(pauseit==0)? copyspeed: 0 u6 S" Y2 W9 b, M, c3 U
var iedom=document.all||document.getElementById
/ q! E8 [/ m9 _) \* z5 lif (iedom)+ c# P9 f* {- E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). H L5 R$ z' [, L5 r
var actualwidth=''6 B, e8 X5 A; d
var cross_marquee, ns_marquee% n% \* D1 f: q& f- q' ?0 X$ r
; V9 e- R0 s7 gfunction populate(){
8 l. d2 u& D& a" y1 uif (iedom){0 ?4 ~/ l4 L0 n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" L0 z$ u& z1 e, G1 Scross_marquee.style.left=marqueewidth+82 u( t6 z3 v8 y& f( }2 W
cross_marquee.innerHTML=marqueecontent- F. L/ P. k) g' r9 S( u4 o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ ^% R: V+ L$ [4 b1 \$ i
}
. _0 e& q5 b* d, |else if (document.layers){
3 x! } z0 L6 l7 d$ ins_marquee=document.ns_marquee.document.ns_marquee2
% e8 ?/ D0 }( i; `0 a' xns_marquee.left=marqueewidth+88 f" q s* I+ J: M* `
ns_marquee.document.write(marqueecontent)0 }; b' Y3 W N3 N
ns_marquee.document.close()5 w5 O- k% G5 x; J/ L. C0 Y$ b9 }
actualwidth=ns_marquee.document.width
: T4 W7 n/ ?2 [$ F! u% |7 w* i2 I}9 e/ L# K4 q& ?. |+ W
lefttime=setInterval("scrollmarquee()",20)+ O) c- o: |+ j0 X' c6 v6 B6 l4 i
}" E' Z' x0 F3 q) g+ `( w, n: V3 n7 x
window.onload=populate
! c! W4 \8 h h Z0 g! B
* ^) z; W x6 a f Y" ofunction scrollmarquee(){9 q# \+ r# g- c$ n7 B
if (iedom){
) Z2 \: G8 b" V- k7 D/ Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); V7 L3 h8 N* D- N Z8 l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 {+ v) i0 \5 `+ F" ]1 M! U2 _else7 e/ r+ ]% W) J" B+ V" C
cross_marquee.style.left=marqueewidth+8
" ^, _+ [5 b* ^2 Q8 W
7 K2 ~+ i' }% I/ a E; ?+ M9 W; I; f}
}1 [4 \7 }* melse if (document.layers){
5 L" z; ~8 B" Vif (ns_marquee.left>(actualwidth*(-1)+8))
4 g" t8 X+ g' K- uns_marquee.left-=copyspeed
( \$ h$ h4 i! B7 m) }2 C. welse
, r; S8 ?/ }& o0 E1 o n- uns_marquee.left=marqueewidth+8% c4 F5 {, N' n( u
}
4 i4 L/ O! V2 I$ u- J}9 F+ S0 M/ s4 u; ]8 g) p( K
S7 [0 \ f( b0 Lif (iedom||document.layers){1 q3 W, r/ y( A8 j6 g9 C& j, n
with (document){+ n5 |: F4 u% R' ]0 c% l5 n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. s$ ^7 Y8 |& n/ V% c' A! Xif (iedom){/ M$ a* ]8 S! O; j. e2 N" S8 q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- F9 ?3 m1 w" Z- H0 \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" i# H# E0 D9 _# v* owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ O# h$ Y) g5 g* E9 S
write('</div>')% v! p$ m- X" ?! e
}" P ]8 h/ _! }! Q9 `5 S
else if (document.layers){
5 F% v7 m( \1 m0 @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; X. n2 r* F! }7 Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): `1 U c1 Y2 L2 F5 W8 F
write('</ilayer>')# \ ~, T; t0 ~
}6 M8 X% k( o6 O4 g" {% y
document.write('</td></table>')+ Z% ?* D Y9 p, o% t; t3 e
}
- O8 e; ]8 ]2 Z' F/ O D5 s+ K}3 \( N- B3 i7 R# ~4 w5 P
</script> |
|