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

|
网页之跑马灯文字特效
//修改宽度
6 z) W! D* O: i/ x* L) g) `0 vvar marqueewidth=300
$ V* w9 f/ t- X9 q//高度
4 N2 b4 H2 n! Q! j9 j3 {( tvar marqueeheight=25
3 F: P/ \( M8 Z: @6 c6 u//速度(1-10)
' Y& f. Y5 L5 fvar marqueespeed=3
6 j8 S3 k/ d* F6 _! \7 {//背景颜色
|0 r# v( t9 f' i- z% [- X$ Cvar marqueebgcolor="#FFFFFF"$ y' ~/ R& E3 n* [0 _+ i6 ^
//是否能暂停 (0=no. 1=yes)? y5 B( l1 h! G5 s, ]
var pauseit=17 h' A1 p! w/ B- g' D# Y1 a
) ~3 r6 q$ }2 M, H, V& ]
//修改显示内容
. z N' n/ T1 W4 J5 svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" x# y! p% R6 a, g
( W' } W: b1 g3 ]8 I
2 v4 c. U2 J# T" C* O
////下面不需改变////////////7 z( J8 x5 w. s" Y( ]2 B$ M6 S
4 Y0 {: P& ~" l* y
var copyspeed=marqueespeed
& b7 Q, n( p2 y% q% Q. Hvar pausespeed=(pauseit==0)? copyspeed: 0
+ l5 i9 q; Z/ Z' M# yvar iedom=document.all||document.getElementById6 d$ g) B. s8 {" K( B3 G0 W
if (iedom)
& ~2 O7 N) r# n! [) D; R# w- Z4 Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' r' {9 p; v" @7 j/ q) _var actualwidth='' r2 q, B/ v; l8 s* y7 o7 K* S) r
var cross_marquee, ns_marquee
: v0 I. I/ K7 j/ m: [' U( L% j8 v2 e0 J3 i! N1 B
function populate(){$ w8 ]+ s$ b9 ^; E- Q& }; `8 {
if (iedom){
. s6 c5 d3 [. Z6 k* w fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 S* @0 X: P# b/ i5 Ucross_marquee.style.left=marqueewidth+8# y4 S4 x# n, O2 U T% E- V
cross_marquee.innerHTML=marqueecontent3 v0 j! I0 d# d$ z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 v, r2 n1 J4 B$ I" g5 V
}
, F$ m3 A, \/ M) Q G( I5 Aelse if (document.layers){
! Y3 S! m8 \1 m' m' e( @ns_marquee=document.ns_marquee.document.ns_marquee20 r2 p6 U: F8 R* K8 p. U* Q
ns_marquee.left=marqueewidth+82 V6 _7 K% g/ Q7 s7 ` S
ns_marquee.document.write(marqueecontent)
$ y, G/ ?& d" n4 H/ V- Z2 ]ns_marquee.document.close()
7 b, k8 X) v( u; Z$ sactualwidth=ns_marquee.document.width" {2 D. M) b. y+ A5 {2 [
}8 d, y' B; i; T+ }9 x
lefttime=setInterval("scrollmarquee()",20)* E; ]( b1 L- E4 l% t& q
} ]) u7 M& T' ^- e
window.onload=populate
/ D# U; L4 o, D6 b; }7 p# o, E" t! S6 r$ K2 U) C
function scrollmarquee(){0 W: y3 Q+ e: u4 {1 e7 |
if (iedom){1 @( w/ l5 h7 h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); V4 n- O) H/ v5 V4 X* |$ P8 L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* M& g9 e; N# k
else
1 D" R5 d# d& k, M# {' `+ r; Qcross_marquee.style.left=marqueewidth+8
* ?8 x: r7 I4 A( G$ m
! ^5 y( i( _ ?}2 O, P- p5 Z8 u9 O! ]$ `
else if (document.layers){6 o G! \; f+ b/ I2 X% Q6 W
if (ns_marquee.left>(actualwidth*(-1)+8))) Y& X, B, r# P$ D' c! p6 M, H
ns_marquee.left-=copyspeed
8 ^: Q& C- s4 Q$ J' Relse" p& A' b2 V# L$ l( P* _' k
ns_marquee.left=marqueewidth+8: Z$ y- W7 M Z& D: L
}
& c2 H( [, S" ]! P* T}0 t% R' Q% ^7 ^4 ^' {
6 z7 e9 @( Z! k- c9 [* H! [4 n
if (iedom||document.layers){
0 j4 f0 i) g |5 Xwith (document){
# f. [& A. q. v6 ~: q. U6 b) s% e# rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& G. S1 v! m$ E
if (iedom){
- g6 A7 N5 q# a! [) |5 J4 E) Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, L1 [0 F0 [; Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; O+ l! h3 f4 hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& c* l- L0 l, L6 a* u4 Q
write('</div>') y$ ^$ X9 I' U6 |* ^% T* y: s- p
}
* M' B# l C$ ? jelse if (document.layers){
( x5 y0 L$ @3 X1 ^* A9 |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- P; t0 m1 _# q! p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" M# s" ?0 _7 G" _write('</ilayer>')
" r- h; x9 f) M5 p0 J+ n}$ U- d( q4 [) o: e) i
document.write('</td></table>')9 ^; v! G/ [& ]
}( e/ X: l9 a2 I/ e- g# ~
}* J( N5 H- F5 L8 C2 p' G
</script> |
|