返回列表 发帖

网页之跑马灯文字特效

//修改宽度' g* i" h- P( \* x# Y2 q* L
var marqueewidth=300+ C& B  b8 N5 N  ^$ T
//高度, H5 ]2 x# R$ k/ {& }# F
var marqueeheight=25
" d3 z/ U9 y* b: n( |  N8 I//速度(1-10)1 n9 {) u. l4 b5 t; p
var marqueespeed=3
* h: K; M" M4 X6 `# N//背景颜色
( \% r9 ~4 Y! b5 ?8 w  ivar marqueebgcolor="#FFFFFF"
4 H& f& X7 p9 q//是否能暂停 (0=no. 1=yes)?3 g5 ]* o! A* g9 ^, [. Z; r
var pauseit=15 ]: n8 V$ Q! v6 s7 K+ H
. m# K* z- N. ^8 {) |4 p1 I
//修改显示内容
! ?  Q9 o9 P+ ~# s# svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' D; k5 i5 e# ^, \# X8 L1 |8 ]% G

* Y: }8 `1 L8 g' C+ |1 J5 O) ~
$ i- f$ ~% Y8 a3 _  m) e5 N////下面不需改变////////////) D( e" g/ C: h% `5 Q2 Y
5 m  M$ {8 T: z- f  V
var copyspeed=marqueespeed
0 j( o+ x* o% g0 kvar pausespeed=(pauseit==0)? copyspeed: 07 I) `8 N# n5 l, e: l2 u
var iedom=document.all||document.getElementById
3 I  d/ x9 W. q5 bif (iedom)
" b# x) ~- s2 `% e. \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' ]( H& s  b# R# p7 _0 ?var actualwidth='') V! K8 w- x& G# S
var cross_marquee, ns_marquee& p) F4 f3 G! w6 q4 z

# Z8 w6 B* Z9 U( g$ H  U2 Afunction populate(){
9 J4 H3 x) {& Uif (iedom){
. ~3 T* g! H  f1 S8 Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 B% f1 @) z' h1 S3 ncross_marquee.style.left=marqueewidth+8
; S/ h" Y: A4 Y( Ocross_marquee.innerHTML=marqueecontent7 |0 j. M0 r/ h5 F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 N! |9 |. P3 @
}! J9 C& [# l9 \: I) W
else if (document.layers){5 t+ F% @8 {* O/ q5 Y
ns_marquee=document.ns_marquee.document.ns_marquee2
  N" T. y9 _: v- E. N5 B: }9 ins_marquee.left=marqueewidth+8
0 r$ K1 Q# [9 `% E2 g% p' k  Gns_marquee.document.write(marqueecontent)
$ P# C( T# C; s$ }* Pns_marquee.document.close()8 w9 ^9 f4 c  x
actualwidth=ns_marquee.document.width
$ {8 |- w" z" l9 n6 C: Q}
; Q5 l' ~' O0 }5 b+ s8 K; K+ dlefttime=setInterval("scrollmarquee()",20)
- ^* p  v3 s% w: L5 b7 w) z}% Z! P- ?5 x' i' A- D  Q& Q, U5 J
window.onload=populate
9 E; `" y! V% x) Q" c4 \
# ?2 C7 e: Z# h2 v9 n6 ?7 hfunction scrollmarquee(){
" Q4 \2 B/ @' uif (iedom){
4 h: G% a4 c' E) Y# V3 zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% H; ?) k& a& H3 k1 T& bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 J; ^* }( q( I6 y! W9 V8 D4 G
else
* j' C1 E) A, f, u* lcross_marquee.style.left=marqueewidth+82 g* ~1 S8 h+ S% p5 F6 I

, m9 p. u- s# i  Q% A}, |, ]( g( P8 a8 y8 j
else if (document.layers){- s, }+ Z8 w5 k6 g- t3 t
if (ns_marquee.left>(actualwidth*(-1)+8)); X4 R( N4 L& a& ?* L8 `
ns_marquee.left-=copyspeed
& F4 Y8 d. a/ uelse
+ A; \9 v% b5 O" x  Z8 [: Hns_marquee.left=marqueewidth+81 y" A. m3 O5 ^% j; s; C
}
. N3 N! C! G8 \0 x0 p}
3 {0 F3 f' ]0 ]' j
6 f6 \. v! v' T; s$ Z2 {if (iedom||document.layers){' h" t' s: _* F6 u7 \0 g! t
with (document){
0 P9 ]% ^3 Q0 \' F. Z& t: g4 Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% s- C# Q, [; U* Yif (iedom){& ]; `# O0 f4 k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# V) E, Q0 X" z4 a7 ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 w" a0 `# z" Q  Y9 }$ J( ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; W2 F, K/ Y* [3 k9 g. b1 Hwrite('</div>')+ U' [% E; k  |% r* R
}
  \! R. p( w: d7 B% Jelse if (document.layers){
6 w& }+ s1 W) ~# H" ]4 R! Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; A' H7 C+ @5 U# ]' H( hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) X: H( Z* r7 K) O4 Y$ c  P% `write('</ilayer>')0 j0 }0 [) y# {# r' O# n# ^
}
' i4 t* R4 v$ x7 {1 @3 l6 Bdocument.write('</td></table>')
; r/ \! T# j, }' {2 R- e}6 j; `" `- H  K% A
}
7 [  ]% w; I7 @' z! b) T+ P</script>

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