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

|
网页之跑马灯文字特效
//修改宽度0 _9 i, ?% \5 z9 E% Q+ k e
var marqueewidth=300
5 o7 k5 R3 d9 q. v! R! E//高度 N7 e% n1 k& i5 o: n6 m
var marqueeheight=25$ m _( H) f, X9 h$ d
//速度(1-10)
' @2 e6 E4 T& t3 P$ `1 evar marqueespeed=30 O% T1 @* J7 d9 N2 K3 J' O
//背景颜色
8 h1 x& k* B$ f' l+ Tvar marqueebgcolor="#FFFFFF"& A/ p3 K Q9 x1 ~& ^0 t4 J% Y
//是否能暂停 (0=no. 1=yes)?
' {. n! ~! t7 Yvar pauseit=1* H3 ^7 f; w) [+ p5 \+ y# {6 G) R
# }6 R6 v: i+ k; r1 \- Y
//修改显示内容" t3 _5 S" A/ f7 [3 P# b9 H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 k. U; n9 }6 M- l% \3 G
+ Q, j% M+ s( G2 l7 Q8 M3 ~/ m* R8 {7 s/ q7 P
////下面不需改变////////////
! V6 P, D! @0 _9 X" N. W5 F# Z) j+ M6 ^7 [* G
var copyspeed=marqueespeed7 g' c( O! H! t7 ^$ Z) d9 y5 `
var pausespeed=(pauseit==0)? copyspeed: 0% P/ k+ P) H$ U& w" z
var iedom=document.all||document.getElementById
. X( j, z3 ]; ~9 D: B+ f3 H6 Pif (iedom)
3 [4 d+ N7 ]7 F9 \5 T3 h3 u C% ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' e& t2 k1 j5 w7 nvar actualwidth=''
5 h( p- z2 T/ y0 g) s. H- vvar cross_marquee, ns_marquee
7 K" q! V6 }4 j/ \
6 j0 S% x# e6 U+ ofunction populate(){
& \. A n0 q/ ~if (iedom){2 k( q0 G# l# f- ^
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 y/ u9 F! }, x$ O# o. z
cross_marquee.style.left=marqueewidth+8! L: b* T! {7 t( ]0 k" d
cross_marquee.innerHTML=marqueecontent( q2 r7 M" C. N4 y! @/ l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 H: [5 K/ P# i; \2 A7 ^
}
) d1 `9 j6 ?1 c# [8 `0 E1 d6 f/ Zelse if (document.layers){
6 Y& [- w; j" [$ _, o: [ns_marquee=document.ns_marquee.document.ns_marquee2' m( d' J; Y' Q [) l# u8 @) N4 _
ns_marquee.left=marqueewidth+8
+ H' o9 C7 u1 U2 l, K' ?- S* C6 [ns_marquee.document.write(marqueecontent). i2 f7 a1 `" g+ E
ns_marquee.document.close()
9 |) f9 e N7 R3 f' g5 N' k3 q8 w6 Iactualwidth=ns_marquee.document.width4 r/ N& v) k4 L/ e' H
}: R# k- j8 j P
lefttime=setInterval("scrollmarquee()",20)
/ K5 H; H5 b) u$ U' w}
% g0 S1 \& z# e/ ^7 s) Lwindow.onload=populate) X3 P a' \+ } }$ b
. `( O2 @, r7 j# W/ \
function scrollmarquee(){
8 M: O5 ^ z) z, V' [( C9 Eif (iedom){
I2 X+ l0 l0 Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; |( N$ A. r7 T' Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 {) G( r# Y+ h8 O" Lelse% J0 v. ]/ P4 Z) E- }5 P/ ?% w
cross_marquee.style.left=marqueewidth+8
$ B* Y* E+ ~. f! R$ l1 {3 |. c
& u \* Z6 }, x' a}
3 ?0 E( C v8 V" S0 yelse if (document.layers){
. A1 ~ u N; H" {" r' `1 cif (ns_marquee.left>(actualwidth*(-1)+8))
" j, @: s$ M1 T3 H+ e }; Q9 lns_marquee.left-=copyspeed
2 w' {* V% O( j" Q; a2 helse1 l/ q C5 D$ |& y _+ [
ns_marquee.left=marqueewidth+84 a" v* R+ M& l( q- s
}% v. N( N h" f
}
! Z0 N l! x4 `1 N" l7 q: e& B) x9 i8 }4 I8 _) F/ e
if (iedom||document.layers){
/ q5 u. W( b3 h1 k( J7 P+ I- hwith (document){
! B/ Z }: r" E: Y1 | B7 x) edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); q: c2 y0 f. @* f4 X
if (iedom){ E8 A8 V- p$ c1 Z: X: r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 K. I$ Y3 J6 t- P! Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% u1 D* u5 ^! }, B; C' o; owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. A2 B H8 Y3 w" ~write('</div>')
2 a* S6 s1 `' \! k# U7 D1 m}
3 H/ o w$ ]2 x0 welse if (document.layers){
- p, g7 M' _" nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! i* l4 g. {9 \' { F8 a; s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: c7 @$ ]! `% ~' L }4 Kwrite('</ilayer>')
" A3 J% k8 u+ w0 x" E}; e# o3 Z! \( K, y: o( f/ T
document.write('</td></table>')- p5 y# m: y9 }8 ?: j
}4 }5 Y& \' u2 \2 |
} b8 L3 E, | `: `/ e% I
</script> |
|