返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 D$ }4 A  i% j$ D! M
var marqueewidth=300
5 X) ]5 r: G  E; P# A8 F! @2 ~//高度7 p8 ]" ?: B& C* m6 l, c
var marqueeheight=25: s$ A. r# v) z
//速度(1-10)
9 @. t/ ~. I& Jvar marqueespeed=3
  K2 Z# E2 q- b: Q- g+ s//背景颜色
4 f5 x. Y" E' o0 l9 Yvar marqueebgcolor="#FFFFFF"" y& y9 d2 Q3 G- ]. R
//是否能暂停 (0=no. 1=yes)?6 |- Y" o% o5 |9 z3 `5 e. \/ r; {
var pauseit=1
! X- b) ?  ]; J  ~+ E
1 {- f, U2 h/ V//修改显示内容' g- }% c! d  `0 i8 K5 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  r- V, S9 p6 W* a. D
3 `, |% `7 k0 l2 [0 X; ]! a7 C
. v6 J( Q2 ~2 g! n) k3 r
////下面不需改变////////////% w2 p- n) Z$ R( R% L
0 N1 `8 }$ v/ w& e5 |
var copyspeed=marqueespeed% `# U  ?/ y7 S
var pausespeed=(pauseit==0)? copyspeed: 0$ a, I" F0 T* D+ n; _4 N; u( S
var iedom=document.all||document.getElementById! [5 @9 N4 ~) _  N7 h) D
if (iedom)6 ]8 e  A' U. ^5 [' ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- b' D+ F9 A! H8 `& l- @; Pvar actualwidth=''
  A. f8 A/ K# ]! K- B2 B) qvar cross_marquee, ns_marquee
. s( T/ Y: N( V; H" w5 L
1 o3 ^) @# G+ u6 G4 z; q: tfunction populate(){/ ]: P7 d0 B( z- u1 K0 D
if (iedom){
6 O2 m9 ?  H0 E2 _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  R  @/ `2 v2 x0 E# R7 @cross_marquee.style.left=marqueewidth+8
' t  ]8 v- _" hcross_marquee.innerHTML=marqueecontent! H% L* f# e3 L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 v4 @0 b6 \$ T. l+ V. m
}- Y  ~. a: Q. a1 w: \2 W9 k/ n
else if (document.layers){
* |) O. K# D0 m+ Gns_marquee=document.ns_marquee.document.ns_marquee2$ U5 D4 K/ M1 s
ns_marquee.left=marqueewidth+8) E! p, m) }: T
ns_marquee.document.write(marqueecontent)
  ?1 q( K; c% r$ `0 W6 n( w7 Fns_marquee.document.close()2 J4 l1 U( @+ G" c1 \' G" L
actualwidth=ns_marquee.document.width9 a3 a, L9 U# U; ^  w5 I" Z0 ~: n
}
& C1 l% {- A# r0 E) W) G% ?, Elefttime=setInterval("scrollmarquee()",20)
$ ?+ f0 k8 e8 D}
9 X$ l  ?  x: cwindow.onload=populate- M- L' j9 c: E: V4 q* @

4 `! j4 ?, ]) S5 `8 v, e% Ifunction scrollmarquee(){
& N. T6 m& s' l4 x" Xif (iedom){
) L$ c" G4 i1 ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 v2 `) N& O5 M# U- }, z) C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- h/ V4 L" H2 K2 k' O7 |, xelse
! G- M3 _: x( ]7 R' h7 Dcross_marquee.style.left=marqueewidth+8( C. }# r, S1 k3 N) T. ~

" p, H3 |6 I7 f: O7 {}: L1 o# p# N9 o6 ^7 L. ]
else if (document.layers){
& p$ Y2 k" _( y! z1 m5 O, G# U- sif (ns_marquee.left>(actualwidth*(-1)+8))
/ Z# G  x# A* @- m& wns_marquee.left-=copyspeed
" I' j. M/ ?6 ^0 g+ Celse. x" M& ?) t3 T% n+ \1 e
ns_marquee.left=marqueewidth+8: A4 T( A3 A! P6 Z  W( g# S
}- V: B2 Q# y8 N( r/ \; Z, J; S' A
}
5 F/ M4 y6 A9 K! T8 \4 B4 U" \- C. o  a( M% X; u: N* O9 u
if (iedom||document.layers){
  n; O0 E' w4 u4 r; h: ^+ ^& ^* Rwith (document){2 ^0 o' X; Y. S( t2 ?  U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) f$ N, s& {9 d- Z8 w# ]+ Cif (iedom){
/ |+ Y4 r( `2 r$ F5 B* n. {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! V7 q+ E4 V+ f! M) w2 @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). N1 d4 ]8 Y" s0 B2 a9 J( b# [" l0 o" x& f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  o% j7 L- {$ mwrite('</div>')
3 u, B+ d. q5 v3 G}
5 D5 I7 T( b$ M* eelse if (document.layers){
+ J3 K- U$ n: y6 Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  `- x2 O2 n2 F& @; \2 Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' M5 K3 r& S# ^& _3 x& Nwrite('</ilayer>')
6 g' f1 C+ d& [/ o}
9 m* r' }' H+ k( X. idocument.write('</td></table>'): P0 u- P; O+ |+ ?' F
}: a/ G+ D2 d- o1 W4 N7 g4 y- ?$ ?
}" Q9 g4 T6 X: }! A5 v6 @% F6 S
</script>

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