返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 P9 V! H. L( G% qvar marqueewidth=300: a6 Y6 ]5 Y) L: F0 s2 ^
//高度. ?" k6 m  i0 g
var marqueeheight=25; a. P$ n4 U) M. R
//速度(1-10)/ G, j" H' d. |+ d; X  j4 Y5 `
var marqueespeed=3
, {5 E! b( T3 L* H; S//背景颜色0 ?* H9 W" s( R* M
var marqueebgcolor="#FFFFFF"
  N+ @( }, Z! c# ?1 u//是否能暂停 (0=no. 1=yes)?
: }  v* f$ n3 K3 J( b8 Ovar pauseit=10 S: _- R% J' X' C' Z

5 O3 X% J7 a& M//修改显示内容) b7 O% p  t! @* s+ u9 [! G- A2 B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( A+ Y' F% O; k: D+ [
$ o7 D7 ~1 a3 Z/ l+ J( H/ B" ^5 I( |4 Y& V& \1 I2 `6 d0 ?
////下面不需改变////////////& }. B- n8 x) F+ i
/ {4 w0 K9 ?1 J4 o- Z$ u2 T
var copyspeed=marqueespeed9 D) \1 V6 J8 g, G$ ?
var pausespeed=(pauseit==0)? copyspeed: 0+ a3 L. f; z; G4 r7 G% g- g
var iedom=document.all||document.getElementById
! i- T  e: ?6 W  y7 d8 X8 Vif (iedom)
2 N& o6 j$ X& t3 |$ |5 k9 a1 a7 |- Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). ^# x6 e; K3 J- t8 i/ e
var actualwidth=''$ ]. b9 _' R& J+ h' ^! B
var cross_marquee, ns_marquee" Y$ s/ `( V, q; k
6 p. Y+ Y- u- r7 D7 s; H8 H/ u5 V
function populate(){
! x- b6 e4 H- Xif (iedom){3 O& s, S3 N8 ?& }4 Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 {# f# e" b( s) j% w6 l6 b
cross_marquee.style.left=marqueewidth+8: ^: O' ?$ M3 v2 T; n3 L9 w) \
cross_marquee.innerHTML=marqueecontent
! T+ u) S3 o3 V( C, }, Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 M+ E% ]6 L" d0 V6 H& Y0 H
}
( l% k7 B" a+ ]+ `else if (document.layers){
3 B6 w5 M( E' K. Z& gns_marquee=document.ns_marquee.document.ns_marquee2
9 l1 |( I5 d. E7 yns_marquee.left=marqueewidth+80 u8 k/ D; _. j2 ~" W2 O5 z. S
ns_marquee.document.write(marqueecontent)
6 \7 H8 v" n- q) jns_marquee.document.close()
; M0 R& W/ O3 O4 xactualwidth=ns_marquee.document.width& E2 z& P- h2 O! c, e
}
/ g, S& [" ?0 h- K2 \1 K" o! jlefttime=setInterval("scrollmarquee()",20)
" K1 c5 y. Z4 W8 E, E}( n9 D2 O4 T( N& h! W; D
window.onload=populate
6 x& ~1 b8 d5 b3 H# |+ I
- t, S/ f1 c" @9 X; ofunction scrollmarquee(){
" R$ N0 X" a; g: E& ~! \- jif (iedom){
# E7 s5 P, I: L% [# ]! F7 \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 H& Q& J+ Y. c" F+ n2 Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 v! g* o) m; B& T! t1 qelse
5 i8 L" Y' a, E9 B7 Across_marquee.style.left=marqueewidth+8
- H( G4 C5 @0 L* ~) s# Z& W; R$ Z  x' c) V8 t7 |9 B
}
" S) j5 {& V  x; ~2 T! t3 A, t" Velse if (document.layers){0 e# x7 N% X: }0 [3 X
if (ns_marquee.left>(actualwidth*(-1)+8)): ]: x) l3 M- W+ N8 c: ]. B3 ]2 z6 f
ns_marquee.left-=copyspeed
* F5 G' L' W2 o0 gelse( y3 h+ R/ N( U5 C( ^$ z( [
ns_marquee.left=marqueewidth+8" z1 X5 d; V. v/ {, ^4 }$ m' C% G( n
}
- Y5 o8 Y+ r0 Z0 i% E}8 ?- ~6 e2 r# Q: z( U

/ w+ |9 I; K) X# U. t. g. Dif (iedom||document.layers){: f+ ~! }8 ?# i; A+ L
with (document){
/ d. ~: g% w+ R, i2 _1 vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 n% H4 U" {. P$ R# uif (iedom){' F9 G6 ^1 ?' c# ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). V" }, ?7 j' v" g) L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, w1 H# [- y+ `2 a" }8 a* O% m# dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: y7 N; t; B, C" uwrite('</div>')
7 R7 r6 d) z# [3 x; u5 w}4 L; a' d$ l: F- g* ?; h
else if (document.layers){+ E' {' p9 e$ O, q- ^2 }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) B4 d. b9 u  d+ Z( `! w$ L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), x% @- V8 R) c1 k5 e& W
write('</ilayer>')' X; G, B: W6 {  {: y0 y
}
) D* k/ p3 K/ J) R( X! Adocument.write('</td></table>')
2 D5 k4 F: {$ @7 w) J3 f}
/ X/ L+ I: c: K' J' H}
; \* S4 P- M% ~7 R8 j</script>

返回列表
【捌玖网络】已经运行: