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

|
网页之跑马灯文字特效
//修改宽度
7 ^: x: I: @( bvar marqueewidth=300: S/ ^4 ^% g& k
//高度/ D# E1 y" K7 @9 l
var marqueeheight=253 f% w; N4 K+ w
//速度(1-10)7 b0 M7 b9 g. R3 ?+ E
var marqueespeed=3
' C$ M3 z' m% y. H; Q//背景颜色6 e- f$ R- C: H5 w: X
var marqueebgcolor="#FFFFFF"
8 L3 g, J$ y4 K3 [0 k6 @//是否能暂停 (0=no. 1=yes)?
3 l& T5 Q/ E7 c- S) k- Ivar pauseit=1
$ e7 ?; k" A2 b
% @$ b" w+ H6 d* n, E- I* c$ P//修改显示内容2 r+ i+ n* a/ n* y0 v. D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. s! h3 L# Q; C' A% l( z! c8 L) k+ t+ |5 e7 x' e
: {8 P5 r) X8 S+ r////下面不需改变////////////
! g1 Q# z# g4 ?1 m# V' J# [! {: j# R& Z" ], i$ l+ }$ e
var copyspeed=marqueespeed
3 ]+ G4 j- h5 ^ J/ `: Ivar pausespeed=(pauseit==0)? copyspeed: 0* V2 ~9 Z K0 c8 i# @2 E4 |& B
var iedom=document.all||document.getElementById! K9 l$ {% z3 [; A, c
if (iedom)
' g7 g# `( z0 q" @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 t2 y" {/ h, o4 d5 O9 Wvar actualwidth=''
. L8 ]; c2 J3 H3 Z' ^6 ]var cross_marquee, ns_marquee- t( Y! T9 ?1 R2 r0 f- z0 h H4 N
3 a' u- q0 ?- O. K$ c9 |; s
function populate(){
! V# ?1 @0 B" W, w' V7 |) ]' F9 Q" E$ Tif (iedom){) o5 b, S/ G; P# u0 k/ n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( g' A3 r4 |7 F7 p% {& P
cross_marquee.style.left=marqueewidth+8
1 @7 d3 [; l! e- p' X# S( D) bcross_marquee.innerHTML=marqueecontent
& Y+ m6 T. D, T Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 {' _; n; s( Y1 D% U}/ D" Z4 w& v$ V8 w& H
else if (document.layers){/ ?- Y6 ~4 |: w. [, L" x
ns_marquee=document.ns_marquee.document.ns_marquee2: X, e& f( `& N- c
ns_marquee.left=marqueewidth+8
W4 z3 Q- ~; X, A3 H& q% z; ens_marquee.document.write(marqueecontent)
1 @5 e% m, S, F, ons_marquee.document.close()( d/ {0 _4 ]' U5 ? P U
actualwidth=ns_marquee.document.width
+ N: ^! `: B7 }$ Q' p! x}
! H- y% r7 |* m) G9 Dlefttime=setInterval("scrollmarquee()",20)
# { q' @( a* H- \; W& p}* q* ^( e$ H$ `1 R
window.onload=populate
# g3 n$ n1 t0 O, O# i8 K5 k( `# X! t; h- q
function scrollmarquee(){
: |2 Z$ {( J6 X) a6 q6 `if (iedom){+ B: S( z4 o8 q/ M. N5 A$ I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. P1 t8 T- E' ~0 V" b7 Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 T7 x$ S3 W" K2 }) ?- _else0 X+ w7 s! e4 \3 I. A
cross_marquee.style.left=marqueewidth+8# u) M+ o+ \1 L5 a1 A
* [6 ^8 [$ S3 u' O J}8 Q+ l5 C8 m& v+ N
else if (document.layers){" s6 V' P* A3 K
if (ns_marquee.left>(actualwidth*(-1)+8))) h9 e M0 r! t! V
ns_marquee.left-=copyspeed1 d0 _4 a5 ?% W) g4 Z
else
5 q9 q, x; w. A: ~8 Bns_marquee.left=marqueewidth+8
+ z4 q+ B- u" r2 `0 N}
8 s: t: J" s& ?" R4 Q7 W H$ h4 e9 t0 F}) z- f1 g% S# }3 a; ?
" b) h" g: X$ `6 ~! p+ `if (iedom||document.layers){0 j! z% i, f# l9 d4 \, O9 }1 s
with (document){
( N4 m' ?* t* N# bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! g, p! Q5 R6 }3 g. n
if (iedom){
6 t- f9 a' |- u% ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 L$ g2 n- L' l/ S( y- l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- {2 G9 `5 e5 S' \- Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 I6 M) [9 ]9 T0 twrite('</div>')5 R" x2 U$ l8 }. v% J6 c
}% Q& N( g# f, S" C6 e0 Y. `; A4 j
else if (document.layers){2 @) l7 [! n" j8 H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- P4 ?. s" i% bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 o" P7 |8 i) u' j% [6 @
write('</ilayer>')7 b' Z$ G1 p4 p8 q+ [" i
}! o: O: U( ^1 X, ^8 o
document.write('</td></table>')8 U p" r1 }% c8 Z4 C
}/ f# h1 Z' a3 g: U+ c# }4 q9 R
}
9 z% y' C8 w, C: K, s$ c- W* n# H</script> |
|